Debug Published Canvas Power App with other users using Monitor | Power Platform

At times, users report that they can’t seem to know what’s wrong with their published App and the behavior is said to be unexpected. At times, no direct error is thrown to them but they don’t seem to understand what’s wrong.

Here’s what we can look at and invite them to join a Remote debugging session.

Open Monitor

In your Canvas Power App, you can find Monitor (which is in Preview as I write this post), this will open a new Monitor interface.

  1. Click on the Menu as shown

  2. Alternatively, also from the list of Apps available to you by permission.


  3. Now, when you open it, you’ll be in the Debug interface. In the interface, look for this open to Play Published App

  4. It’ll open the actual App in Play mode in the new tab.
    On the new Tab, you’ll see this message to ask you if you want to Join the session.

  5. Once you click on Join, the App will open with the message on top saying that you’ve joined the debug session.

  6. Let’s say I do a simple data entry operation by select one of the records and trying to modify it.


  7. As you then perform Actions in your App, your operations will be captured in the Monitor for you to review and debug what’s wrong.

  8. Also, if there are any specific errors that occurred, they are highlighted with Red row. You can simply click it and the details will appear on the right.

  9. Error can be investigated as below

  10. You can then investigate and see what was sent and how the payload was etc. and work towards further debugging/investigating it.

Invite Others to Debug session

Also, if you want others to simply look at what’s being captured. You can invite other users to your debugging session by clicking on Invite button

Enter their Email address and they’ll show up in the list. Copy the Link from their row and pass it on to them to join the session. They will be in read only mode and can see what’s captured and look at error details.

They can only watch and not Play the App themselves or invite others. See below

Hope this helps!!

Here are some more Canvas Power App based posts you might want to check –

  1. Implement character length validation in a Canvas Power App | Power Platform
  2. Download a File from a Canvas Power App using a button | Power Platform
  3. AddColumns() function to dynamically add columns to a Data table in Canvas Power App | SharePoint List
  4. Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
  5. Log Canvas Power App telemetry data in Azure Application Insights | Power Apps
  6. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate
  7. Send a Power App Push Notification using Flow to open a record in Canvas App | Power Automate
  8. Launch URL on a Data Table Text column selection in a Canvas PowerApp | SharePoint Lists
  9. Aggregate functions in a Canvas Power App | Using on SharePoint Lists
  10. Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform

Thank you!!

Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform

One of the most common asks is to be able to search CDS records in a Gallery control in real-time using a Text-box.

Search Box & Gallery connected to CDS

Let’s design a simple gallery that is populated with CDS records from Account entity.

  1. Take a Text Input control (Textbox) and make it look like a Search Box.

    In order to have the Search watermark, write the text to appear as water-mark, enter it in Hint text property of the Text input


  2. Take a Gallery control and select Data Source as Accounts from CDS.


    The way the above shown Gallery control is populated is by selecting a CDS Data Source which is as below –

Filter records

Finally, there’s a 1-line formula that will do the trick for you

  1. In the Items property of the CDS Gallery, I have to filter the records based on the Text of the Text Input on my form.


    Marked by green arrow Filter() function is the one which handles filtering of the data set based on the parameters demanded by the method. Here’s Microsoft Docs on the same – https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

    Underlined by red Accounts is the CDS data source which I want to filter on.

    StartsWith() is a method which is used to compare the start of the string in question. In this case, the text I enter in the SearchField textbox.

    1. ‘Account Name’ is the field in the Accounts dataset to be considered on which the search parameter is dependent.
    2. Underlined by purple SearchField.Text in which SearchField is the textbox which is used to query the Name of the Account and .Text is Text value of the string which will be considered.

    So at all times, whenever there’s a change in the Textbox value, the Items of the Gallery control are supposed to be updated with the filtered records.

Working

Now, when you use the App, here’s what it will behave like. As you type, the records will filter with a certain delay (depending on how large your dataset is)

Hope this was useful!!

Here are some more Canvas Power Apps posts you might want to check –

  1. https://d365demystified.com/2020/08/31/log-canvas-power-app-telemetry-data-in-azure-application-insights-power-apps/
  2. https://d365demystified.com/2020/08/25/call-http-request-from-a-canvas-power-app-using-flow-and-get-back-response-power-automate/
  3. https://d365demystified.com/2020/08/16/send-a-power-app-push-notification-using-flow-to-open-a-record-in-canvas-app-power-automate/
  4. https://d365demystified.com/2020/08/07/recover-deleted-d365-powerapp-environment-using-powershell/
  5. https://d365demystified.com/2020/08/07/recover-deleted-d365-powerapp-environment-using-powershell/

Thanks!

Log Canvas Power App telemetry data in Azure Application Insights | Power Apps

Here’s how you can register your Canvas Power App in your Azure’s Application Insights and log telemetry data into Azure.

Some basic info about what all you can see in Application Insights is –

  1. Count of Users who used the app
  2. Events logged, Sessions logged
  3. Device info
  4. Region info

It’s quite simple to set it up! Let’s take a look –

Registering in Application Insights in Azure

First, make sure you do have an Azure Subscription. Let’s look at how you can register an Application Insight record.

  1. Look for Application Insights in Azure in the search bar

  2. Then, among other records, you can register a new one which will identify with your Canvas Power App

  3. Review all that you entered and move ahead

  4. It’ll be deployed pretty quickly within a few minutes unlike some heavy Azure resources

  5. Upon completion, you can navigate to the resource and see the details

    Zoomed In


Add Instrumentation Key to Canvas Power App

Next step is to add the Instrumentation Key to the Canvas Power App

  1. Look for the App itself in the Navigation tree

  2. Once you select that, you can then look at it’s Properties on the right hand side. In Instrumentation Key, paste the Instrumentation Key you copied when you created the App in the Azure.

  3. And to go with that, let’s say my Canvas Power App has some basic structure like below

Using Application Insights

As the users use the Canvas App, the following information is logged –

  1. Navigate to the Usage section in the Application Insights you registered and if you scroll down on the main pane, you can see w

  2. And then scroll down to reveal more Insight data


  3. Or, if you see Events, you can see info like this –

    I’m not completely sure why my users showed high when I tried with only 2 users. But perhaps, once I dive more deeper into using Application Insights and how each of the metrics are read, I’ll come back to update this post. 😊

And likewise, if you know how to read the Application Insights, you can customize this to give you what you need to see.

Here is some Microsoft Documentation on Application Insights to help you out –

  1. https://docs.microsoft.com/en-us/azure/azure-monitor/app/usage-segmentation

Hope this was useful. Here are more Azure/Canvas Power App related posts you might want to check –

  1. Call Azure Function from Dynamics 365 CRM using Webhooks
  2. Use Azure App Passwords for MFA enabled D365 authentication from Console App
  3. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate
  4. Launch URL on a Data Table Text column selection in a Canvas PowerApp | SharePoint Lists
  5. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate
  6. Send a Power App Push Notification using Flow to open a record in Canvas App | Power Automate
  7. Aggregate functions in a Canvas Power App | Using on SharePoint Lists
  8. Count of total CDS records returned in a Canvas Power App connection [Quick Tip]
  9. Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform
  10. Implement character length validation in a Canvas Power App | Power Platform

Thank you!

Send a Power App Push Notification using Flow to open a record in Canvas App | Power Automate

Let’s say most of your users are using custom Canvas Power Apps to follow their business tasks and rely on Canvas Apps for their actions inside Dynamics 365.

There could be scenarios where you want to notify them conditionally of important items that need their attention.

Scenario

Let’s say you have a few users whom you want to tell them that an Opportunity was Won. It could be a team or a single User.

Here’s what my scenario is – A PowerApp Notification is sent to designated User(s) using Flow. When an Opportunity is Won

A Power App Notification is received

And when user clicks he Notification, Canvas Power will open and show that record.

But of course, your implementation/applications for this can be limitless!! This is just my example!

Flow

Here’s what the Flow looks like –

  1. I’m triggering the Flow on Update of the Opportunity. You can use Trigger Conditions to make sure your Flow is triggered only on the update of the Opportunity Win

  2. [Optional, according to my scenario] I want to send this to the Owner of the Opportutnity for now. Of course, it makes sense to send it to others. But let’s keep it simple for now. 🙂
    So, I’m capturing Email address here to be used further down



  3. [Optional, according to my scenario] Further, I’m only checking if the Status was Won. Status Reason = 3 meaning Opportunity was Won


  4. Next, once your condition is satisfied, you can search for this Connector and Action in your Steps in the Flow.


  5. For now, you only have this one Action which you’ll need.


  6. This is how it looks –
    Recipient Item – 1 holds the Email address of the User to whom the notification will be sent to. More can be added by using the + Add new item button.
    Message holds what should be displayed when the notification is received to the end user.
    Open App – Yes/No. Boolean to set if the Power App is supposed to be Opened upon selecting the Notification or not.
    Parameters – You can pass parameters to the Canvas App and use it inside Canvas App. Example: To open the record directly if the App is designed in that way.



  7. First thing you need to do is to create a specific connection for this so that you can use it to open the specific App in Power App.


  8. You can give your Connection a name and then the ID of the App must be entered. Once done, click create.

  9. In case you’re wondering where you’ll get the App ID. You can find the Canvas App ID in the Details section of your Canvas Power App, you’ll only need that to be copied


  10. And you can enter the below options –
    In my example, I’m sending an alert to the email I captured in #2 above.. In your case, you can set this dynamically and add more as well by clicking on “+ Add new item

    In Message, I’ll enter what the notification should read.
    Open App is set to Yes. Means if I click the notification, it’ll open the Canvas Power App whose ID I used above to create the Connection.

    Parameters, this is optional. If you want to open the specific record, you can pass the GUID like this and in the next section, we’ll see how we can open the record using that.

Canvas Power App

In the previous step, remember we sent the Guid as parameter to the Canvas Power App, here’s what you can do to read the record and use it to open the specific record.
Here’s how you can read Parameters passed to the Canvas Power App.
Param(“<ParameterName>”)

I’m using it to Lookup the Opportunity that I passed from the Notification to the Canvas Power App.

In my application, I’m using Lookup to fetch the record and set it to the Item property of the Edit Form control


Some references to use if you’re looking to Capture Parameters and Lookup/Filter data based on your GUID is that’s your implementation.

  1. Pass Parameters to Canvas Power App – https://sachinbansal.blog/2018/06/17/powerapps-canvas-app-how-to-pass-parameter-in-app-url-display-data-based-on-parameter-passed/
  2. Lookup/Filter Records – http://linnzawwin.blogspot.com/2019/12/power-apps-using-common-data-services.html

Working

Let’s say an Opportunity was Won in Dynamics 365.

And the user will receive a notification like this.


Clicking on which, they’ll be taken to the Canvas Power App record which I set in my Canvas Power App.

Hope this was helpful!

Here are some more Canvas Power App posts you might want to look at –

  1. Launch URL on a Data Table Text column selection in a Canvas PowerApp | SharePoint Lists
  2. Aggregate functions in a Canvas Power App | Using on SharePoint Lists
  3. Count of total CDS records returned in a Canvas Power App connection [Quick Tip]
  4. Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform
  5. Restore older version of a Canvas Power App | Power Platform
  6. Logged In User details in a Canvas Power App
  7. Implement character length validation in a Canvas Power App | Power Platform
  8. Implementing Exit app, Logout and Confirm Exit features in a Canvas Power App
  9. Number Formatting in a Flow | Power Automate
  10. Generate Dynamics 365 record link in a Flow using CDS connector | Power Automate
  11. Accept HTTP Requests in a Flow and send Response back | Power Automate
  12. Pause a Flow using Delay and Delay Until | Power Automate

Thank you!

Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform

Most useful scenarios is to create what we commonly call as “Dependent OptionSets” in Dynamics 365 context.

Scenario

Here, Country and State are 2 entities in CDS. Each Country has N states i.e. Country is a parent entity of State entity.
undefined

We’ll create 2 Drop-downs in a Canvas Power App i.e. 2 OptionSets namely Country and State that selection of Country will affect what should be populated in State entity. Simple!
undefined

Setting up your Drop-down controls

Let’s see how the drop-downs are set.

  1. Drop-down 1 is populated from Countries entity in CDS (Common Data Service)
    undefined

    undefined
  2. For State to be filtered based on the Country, we’ll use Filter() function to show records based on what Country is selected in Drop-down 1.
    For Items of the Dropdown2 control, we’ll write the below formula
    undefined
    undefined

    So, the Filter([EntityToPopulate], ‘[LookupFieldNameOfParent]’.[EntityOfParent]) = [DropdownControl].Selected.[GUIDFieldOfParentEntity])
    Sorry, it’s a little rough on the eyes!
  3. And it will give you the below. Select Country first
    undefined

    select your parent record
    undefined


    Then, the drop down will populate child records based on the Country. So the States will show up which have lookup to India as Country.
    undefined

And that was it!

Here are some more Canvas PowerApp posts you might want to look at –

  1. Restore older version of a Canvas Power App | Power Platform
  2. Implement character length validation in a Canvas Power App | Power Platform
  3. Logged In User details in a Canvas Power App
  4. Implementing Exit app, Logout and Confirm Exit features in a Canvas Power App
  5. Variables in Canvas Power Apps | Global and Context
  6. Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform
  7. Adding a Canvas PowerApp to Teams
  8. Sending Image from Canvas PowerApps to SharePoint Document Library using Flows

Hope this helps!!

Variables in Canvas Power Apps | Global and Context

For all newbies, being able to use Variables is one the most curious questions put out immediately. Here’s a simplistic example of using Variables, both Global and Contextual in this post.

headerImg

Global Variable

Global Variables as the name suggest, run through the entire App itself and can be changed and altered when needed.
Global variables can hold boolean, string, number etc.

  1. Let’s say, I have a Text field called GuestNameField
    guestFieldAdded
    guestNameFieldView
  2. Global Variables are created and set by using Set(variable, value) function.Now, on the OnChange event of the GuestNameField above, I’m setting the variable by the formula Set(guestName, GuestNameField.Text). Where, guestName is the field I created on the fly and I’m setting the text from the GuestNameField textbox whenever the Textbox will trigger OnChange Event.
    formulaWritten
  3. And I have a Label called as DisplayValue which will read from the variable and set it’s text.
    readFromVar
  4. Now, when I run the app and type the name, and when I release the focus on the text box, the
    typeName
    And when the focus from the TextBox is released, OnChange of the TextBox will trigger and the Label will display the text written since it’s reading the value from the variable
    appear

Context Variable

Now, a variation to the Context Variable from the Global Variable is that the Context variable have the scope of the only the current screen they are declared in. Navigate function is also a form of Context variable in which case, you can pass values to other screens.

Context variables can hold strings, numbers, records and tables.

  1. Now, in case of Context Variables, you use UpdateContext({variable: value}) in the formula.
    contextVar
  2. And is accessed/read by simply writing the name of the variable directly
    directContextVarName
  3. And it behaves in the same way, you write something and it can be read
    typeName
    And displayed below as seen in the above Global Variable example
    appear

Checking your Variables

In case you’re wondering you’ll lose track of your variables, you can check the File menu and access the Variables section as shown below
menuItem

Global Variables as marked above can be accessed in their own section
globalStored
And if you open any of those, you can see and even navigate to where they are used.
globalUsage

Similarly, for Context Variables are denoted by the Screen names they are in.
contextStored

I tried to summarize this on a high level. You can refer this Microsoft Documentation for details Understand canvas-app variables in Power Apps.

Hope this was easy!

In case you are looking for more post related to Canvas PowerApps, here you go –

  1. Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform
  2. Adding a Canvas PowerApp to Teams
  3. Correctly connect to an Excel file in a Canvas PowerApp
  4. Sending Image from Canvas PowerApps to SharePoint Document Library using Flows

Thank you!

Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform

One of the most common asks when using CDS as Data Source in a Canvas Power Apps is – How do I get the data from N:N entities?

Well, I’m attempting to explain this in the easiest way possible.

Scenario

Let’s assume Account entity has an N:N relationship with Account Plans entity

Account <–N:N–> Account Plans.

And in Dynamics 365, you simply add these records by going into related records and adding them using Add Existing button
addExistingInD365

And now, you want to access this data for a record in a Canvas Power App? Correct? Let’s get going with it.

Enable the Entities involved

In this example, the entities involved are Account and Account Plans

  1. Accessing data for N:N entities require the entities to be enabled for Change Tracking. Let’s check that in CDS
    settingsOfAccount
    changeTrackingEnabled
  2. And also the same thing for Account Plan entity as well
    settingsOfPlans
    changeTrackingEnabled

Reading Data in a Canvas Power App

I’ve kept the presentation of my Canvas Power App very crude, please excuse me for that.

Scenario: Now, let’s say you want to see the N:N data on selection of a record i.e. on selection of Account, you want to see what all Account Plans are added to that Account.

  1. Now, to demonstrate this, I’ve taken 2 galleries i.e. AccountGallery to show list of Accounts
    accountGallery
  2. And probably a list to just display what Account Plans are added (You can have any other control depending on what you want to do with these records). I’ll call the table AccountPlansTable
    accountPlansTable
  3. And my formula to display the N:N records will be –
    AccountGallery.Selected.’Account Plans’
    aboutToSelect
    finalFormula
  4. Now, you’ll need to add what fields should be shown from Account Plans entity to identify the records. Well, obviously, Name field is the most relevant here.
    I’ll click on Edit Fields for the AccountPlansTable
    editFields
  5. And add the name field from that entity
    nameAndAdd
  6. Once this is set, my App is ready to run
    preparedApp

Accessing the N:N records

Let’s run the app and see how we can read these N:N records
Once I click on ABC/1/2&3, I can see the related N:N records in the DataTable below
working
Simple enough!

Here are some more posts you might like –

  1. Create your first PowerApp! Connect to SharePoint Online List
  2. Dynamics 365 Solutions’ New Experience in Power Apps, Solution Checker and more
  3. AutoNumber field in CDS | PowerApps
  4. Sending Image from Canvas PowerApps to SharePoint Document Library using Flows

Hope this helps!!