Archive

Archive for the ‘PowerApps’ Category

[Step by Step] Power Apps | Show pop ups in Canvas App

November 15, 2022 Leave a comment

In this article lets see how to show pop-ups in Canvas Apps using Container controls. I am going to explain this topic with two different examples. A ‘Single Popup’ and ‘Dual Popup’.

Single Popup in action:

Dual Popups in action:

Now that you got an idea of the two examples, lets go ahead and learn how to build them.

Step by Step to show single popup:

  • Create a new Canvas App.
  • Add a button ‘Demo Single Popup’ to the screen to show popup.
  • To display a popup, we would need 2 Container controls.
    • First container will bring the gray out affect speeded across the screen.
    • Second container will hold the display content and acts as popup pane.
  • So add the 1st Container on the screen and spread it across the screen.
    • I’ve named the Container as ‘cont_One’.
  • In the “Fill” property of Container (i.e., cont_One), set the value as RGBA(169, 169, 169, .75)
    • RGBA(169, 169, 169, .75) gives gray out affect. You may also use your own color combination.
  • Now add the 2nd Container, by selecting the 1st Container (i.e., cont_One). Make sure you select ‘cont_One’ before adding the second container.
    • I’ve named the2nd Container as ‘cont_Two’.
  • Place the 2nd Container (i.e., cont_Two) middle of the screen and set the background color.
  • Its time to add pop up content. So, select ‘cont_Two’ and add the controls. I’ve added a Label and Button controls as shown below.
  • Now that we got the layout ready, its time to implement hide/show of popup logic.
  • As we need to show popup only on ‘Demo Single Popup’ button click, set a Boolean variable by name ‘ShowPopup‘ on ‘OnSelect’ of ‘Demo Single Popup’ button.
    • Formula : UpdateContext({ShowPopup : true});
  • Now select 1st Container (i.e., cont_One) and set ‘Visible’ as ‘ShowPopup‘ variable which we defined in the previous step.
  • As the popup should be closed on click of ‘Close’ button on 2nd Container (i.e., cont_Two), select the ‘Close’ button and on ‘OnSelect’ event, set the ShowPopup to ‘false’.
    • Formula : UpdateContext({ShowPopup: false});
  • That’s it. Play the App and you should see popup on click of ‘Demo Single Popup’ button and should close on click of ‘Close’ button.

Step by Step to show dual popup:

In the dual popup scenario, everything remains same as we did for single popup and additionally we will add a 3rd Container. Lets get started.

  • Repeat the steps you did during single popup.
    • There is a slight change than what we did in single popup demo in terms of controls.
    • I’ve added ‘Rating’ control instead of label.
  • Now that we added ‘cont_One’ and ‘cont_Two’, to get the dual popup, select ‘cont_One’ and add a new Container and name it as ‘cont_Three’
  • Place the ‘cont_Three’ on top of ‘cont_Two’ and add controls as shown below.
  • We got the layout ready, its time to implement hide/show of popup logic as below.
    • On click of ‘Demo Dual Popup’ button on main screen
      • Show ‘cont_One’.
      • Show ‘cont_Two’
      • Hide ‘cont_Three’.
    • On click of ‘Rate Us’ button of ‘cont_Two’
      • Show ‘cont_One’.
      • Hide ‘cont_Two’.
      • Show ‘cont_Three’.
    • On click of ‘Close’ button of ‘cont_Three’
      • Hide ‘cont_One’.
      • Hide ‘cont_Two’.
      • Hide ‘cont_Three’.
  • Don’t worry, if the above conditions scares you. Its easy to implement. Its how we did by defining ‘ShowPopup‘ variable in showing single popup example. Additionally we would need another variable ‘ShowDualPopup‘ for dual popup.
  • On ‘OnSelect’ event of ‘Demo Dual Popup’ button, set ‘ShowPopup‘ variable as ‘true’ and another variable ‘ShowDualPopup‘ as ‘false’.
    • Formula : UpdateContext({ShowPopup : true, ShowDualPopup:false});
  • Now select 1st Container (i.e., cont_One) and set ‘Visible’ as ‘ShowPopup‘ variable. (Refer screen from single popup example if you need help).
  • Now select 3rd Container (i.e., cont_Three) and set ‘Visible’ as ‘ShowDualPopup‘ variable.
  • As we need to show ‘cont_Three’ only on click of ‘Rate us’ button of ‘cont_Two’, on ‘OnSelect’ of ‘Rate us’ button set the ‘ShowDualPopup‘ variable to ‘true’.
    • Formula : UpdateContext({ShowDualPopup : true});
  • Important point to note is that, we dont need logic to Hide/Show ‘cont_Two’ as it gets visible when ‘cont_One’ is visible and it gets hidden when ‘cont_Three’ is visible as ‘cont_Three’ is top of ‘cont_Two’.
  • Finally, as we need to hide all the popups (i.e., cont_One and cont_Three) once you click the ‘Close’ button on ‘cont_Three’, on ‘OnSelect’ of ‘Close’ button set both ShowPopup and ShowDualPopup variables to ‘false’.
    • Formula : UpdateContext({ShowPopup:false,ShowDualPopup :false})
  • That’s all needed for dual popups. Play the App and you should see dual popups.

🙂

Power Apps | Change App Owner using Power Automate Flow

November 4, 2022 1 comment

Assume that you have a canvas app with Owner as ‘User 1’ and you would want to make ‘User 2’ as Owner of the App.

We have couple of options.

In this article lets see how to use Power Automate Flow to change the Owner. Following is how the completed flow looks like.

Key in this flow is ‘Set App Owner’ Action and following are the parameters.

NameKeyRequiredTypeDescription
Environment NameenvironmentTruestringName field of the Environment.
PowerApp NameappTruestringName field of the PowerApp.
API Versionapi-versionstringThe date value of the API version.
Content TypeContent-TypestringThe content type of the API request.
Role For Old App OwnerroleForOldAppOwnerstringThe role name for the old app owner. Choose from CanView, CanViewWithShare, or CanEdit.
New PowerApp OwnernewAppOwnerstringThe principal object ID of the new owner.

Lets see step by step process to build the flow.

Step by Step budling flow:

  • Create a new flow as shown below.
  • As mentioned, key component of this flow is ‘Set App Owner’ Action and in the next steps, we will see how to pass parameters to ‘Set App Owner’ Action.
  • First we need to capture the ‘New PowerApp Owner’ parameter which is ‘Principal object ID’ of the User.
    • Note: ‘Principal object ID’ is not GUID of ‘System User’ in Dataverse. Its Azure Active Directory ID.
  • Add a ‘Get user profile (V2)’ action of Office 365 Users connector to capture the ‘Principal object ID’ of the User.
  • Rename the ‘Get user profile (V2)’ to ‘GetUserProfile’. (Optional Step)
  • Set “User (UPN)” as the User Id of the new Owner.
  • Now add ‘Set App Owner’ action.
  • Set ‘New PowerApp Owner’ as ‘Id’ from the output of previous ‘GetUserProfile’ action.
  • For ‘Environment Name‘ parameter, go to Power Apps maker portal, open ‘Settings -> Developer resources’.
  • Copy ‘Environment ID’ and paste in ‘Environment Name‘ parameter of ‘Set App Owner’ action.
  • For ‘PowerApp Name‘ parameter, go to Power Apps maker portal, open ‘App -> Details’.
  • Copy the ‘App ID‘ and paste in ‘PowerApp Name’ parameter of ‘Set App Owner’ action.
  • For ‘Role For Old App Owner‘ parameter, either you can leave or provide ‘CanView’.
  • Leave ‘API Version‘ and ‘Content Type‘ as default.
  • You should see the flow as below once you follow all mentioned steps.
  • That’s all needed!. Run the flow and you should see the owner of the App to the new user mention in the flow.

🙂

Canvas App | Formula to combine combo box selected items

November 2, 2022 Leave a comment

In this short blog post, lets see how to write formula to combine combo box selected items in to text with a separator.

Formulas:

Single column collection:
  • If the Combo box items is a single column collection as specified below.
  • Use ‘ThisRecord.Value’ in the Concat function.
    • Formula : Concat(cmbFruits.SelectedItems,ThisRecord.Value,”,”)

Multi column collection:
  • Use ‘ThisRecord.{Attribute_Name}’ in the Concat function.
    • Formula : Concat(cmbFruitsTable.SelectedItems,ThisRecord.Name,”,”)

🙂

Dependent Assembly plug-ins| Asynchronous mode error | Expected non-empty Guid

October 28, 2022 1 comment

In one of my previous articles, I’ve explained about Dependent Assembly plug-ins using which multiple assemblies/nuget packages can be seamlessly used in a single plugin assembly.

While exploring further, I’ve noticed a behavior (Issue) that if you register plugin in ‘Asynchronous’ mode, the ‘System Job’ is failing immediately with “Expected non-empty Guid.” error.

Steps to reproduce:

  • Create a plugin project using ‘pac plugin init’ (Steps specified here).
  • Add a simple plugin class with just a tracing message.
  • Register the plugin package and a new plugin step in ‘Asynchronous’ mode.
  • As, I’ve registered the plugin on ‘PostAccountCreate’, I went ahead and created a new Account record.
  • Since its ‘Asynchronous’ plugin, checked ‘System Job’ which failed with “Expected non-empty Guid” exception.

Reason:

🙂

Canvas App | Open msapp file with the new menu options

October 21, 2022 Leave a comment

Assume that someone shared you a canvas app (i.e., .msapp file) and you would want to open the .msapp file in Canvas studio.

With the new menu options steps to open a .msapp file changed a bit. There is no ‘File’ tab option to open the .msapp file as shown below.

Lets see how to open an .msapp file with new menu options.

Steps to open .msapp file:

  • Connect to Power Apps maker portal.
  • Create a new Canvas app by selecting ‘Home -> Blank app’.
  • Follow the steps shown below.

🙂

Categories: PowerApps Tags: ,

Power Platform | Office 365 Outlook Connector | REST API is not yet supported for this mailbox

October 18, 2022 Leave a comment

Other while importing a solution from market place, I had to create a Office 365 Outlook connection to complete the setup.

However got following “REST API is not yet supported for this mailbox” error while creating the connection.

Reason and fix:

Error could be because of 2 reasons

  • Missing valid license
    • Troubleshoot this by logging to https://outlook.office.com/. If you could connect, then the issue might not be with license.
    • But if you get an error similar to below while logging to https://outlook.office.com/, its because of missing a valid license.
    • Ask your Admin to grant the User with either Office 365 or Azure Active Directory Premium license.
UTC Date: 2022-10-18T09:30:08.758Z
Client Id: xxxxxxxxxxxxxxxxxxxxx
Session Id: xxxxxxxxxxxxxxxxxxxx
Client Version: 20221006031.10
BootResult: configuration
err: Microsoft.Exchange.Clients.Owa2.Server.Core.OwaUserHasNoMailboxAndNoLicenseAssignedException
esrc: StartupData
et: ServerError
estack: Error: 500
    at f (https://outlook.office.com/mail/:341:261409)    at https://outlook.office.com/mail/:341:269776
st: 500
ehk: X-OWA-Error
efe: xxxxxxxx, xxxxxxx
ebe: xxxxxxxxxxxxxx
emsg: UserHasNoMailboxAndNoLicenseAssignedError
  • Missing ‘Mail Box’ configuration
    • Make sure a Mailbox is configured for the user

🙂

Categories: PowerApps Tags: , ,

[Step by Step] Dataverse | Plugins | Using Dependent Assemblies

August 30, 2022 3 comments

In this article, I am going to highlight the limitations of conventional plug-in development and how the Dependent Assemblies feature addresses those limitations.

Limitations of the conventional plugins:

As we know that the plugins can be registered only as an individual .Net assembly, we can’t include another assembly or a resource file within a plug-in.

  • For example, you may want to use Newtonsoft.Json.dll or another assembly. You may want to access a list of localized strings which is not possible using native plugin development.

Workaround to support multiple assemblies:

ILMerge
  • One way to include another assembly is to combine it into one using ILMerge.
  • While ILMerge worked for many, it was never supported by Dataverse and it didn’t always work.
  • ILMerge is no longer being maintained.
Shared Projects
  • Other approach is by using Shared Projects.
  • In Shared Projects, the unit of reuse is the source code, and the shared code is incorporated into each assembly that references the shared project.

Both ‘ILMerge’ and ‘Shared Project’ options are workarounds and not recommended. Lets see how ‘Dependent Assemblies’ addresses these gaps.

Dependent Assemblies:

  • With dependent assemblies, rather than register an individual .NET assembly, you will upload a NuGet Package that contains your plug-in assembly and any dependent assemblies.
  • Unlike ILMerge, we can also include other file resources, such as JSON files containing localized strings. This NuGet package file is stored in a new table called “PluginPackage”.

If things are unclear at this point, dont worry, I will explain step by step with 2 scenarios. But before that, lets get the prerequisites ready.

Prerequisites:

  • Visual studio 2019 or later.
  • Download latest Plugin registration tool.
  • Download and Install Power Platform CLI
    • Don’t worry if you are not familiar with Power Platform CLI. We will not use complex commands.
    • We will only use one simple command to create Plugin project template.
  • Install NuGet Package Explorer
    • This is optional but a useful tool.
  • A blank solution in your Dataverse environment.

Once you got the prerequisites, lets gets started by creating plug-in assembly project.

Create a Plug-in project:

We will create plug-in project using Power Platform CLI command. As mentioned earlier, we only use CLI to create plug-in project. Steps as follows.

  • Create a new folder and open the ‘Command Prompt’.
  • Execute “pac plugin init” command.
    • Signing plug-in assemblies is not required in ‘Dependent Assembly’.
    • You can skip signing by adding “-ss true” tag to pac plugin init command.
  • “pac plugin init” command creates a .NET Framework Class library project which looks as below.
  • Open the project using Visual Studio and build. A new NuGet package gets generated for the project.

Now that we have project created, lets proceed with our first scenario.

Scenario 1 : Using ‘Newtonsoft.Json.dll’ in Plug-in project

Lets see how easily ‘Newtonsoft.Json.dll’ can be used in our plug-in project. The scenario I am using is on pre create off Account, I am setting ‘Name’ field by parsing json string.

  • Open the plug-in project created in previous step.
  • Rename the ‘Plugin1.cs’ file to ‘PreCreateAcount.cs’.
  • Install the ‘Newtonsoft.json’ package using Nuget Package Manager.
  • Add the following code snippet which uses JsonConvert.DeserializeObject method of NewtonSoft to “PreCreateAcount.cs” file
  • Build the project.
  • Note: With ‘Dependent Assemblies’ we dont need to sign the assemblies. Signing is optional. However ‘pac plugin init‘ command signs the assembly by default. So, go to project properties and uncheck the ‘Sign the assembly’.

View your NuGet package
  • Once you build the project, as an optional step, you can NuGet Package Explorer to examine the NuGet package.
  • Little bit of Dependent Assembly back ground logic , if you are interested.
    • When you upload your NuGet package, any assemblies that contain plugin classes will be registered in PluginAssembly table and associated with the PluginPackage.
    • At runtime, Dataverse copies the contents of the NuGet package from the PluginPackage row and extracts it to the sandbox runtime.
    • This way, any dependent assemblies needed for the plug-in are available.
Deploying the nuget package:
  • Build the project and open the plug-in registration tool.
  • Use ‘Register New Package’ and map the .nupkg file which will be available under your plug-in project bin\debug folder.
  • Select the Dataverse solution which we created as part of prerequisites. You can also use any existing solution.
  • Click on ‘Import’.
  • As a next step, register a new step on Pre Account Create, like how we used to create in regular plugin registration.
  • Post step registration, your Package should look similar as below.

Test the plugin:

As we developed and registered the plug-in package, its time to test.

  • Open a new Account from and provide some name.
  • Up on save, ‘Name’ should get replaced with ‘Rajeev Pentyala’ which is what we developed in our plug-in.

Scenario 2 : Using ‘Newtonsoft.Json.dll’ in another C# project

In scenario 1, we have seen how to use ‘Newtonsoft.Json.dll’ in the same plug-in assembly project. In scenario 2, lets see how to use another project.

  • Add a new ‘Class Library’ project. I named project as ‘Helper’.
  • Install the ‘Newtonsoft.json’ package using Nuget Package Manager.
  • Rename the ‘Class1.cs’ to ‘AccountHelper.cs’
  • Add following code snippet.
  • In the plug-in assembly project, add ‘Helper’ project as a project reference.
  • In the ‘PreCreateAcount.cs’ plugin class, call the AccountHelper.GetName()
  • Build the solution.

Update the nuget package:

As we changed the logic to fetch ‘Name’ from ‘Account Helper’ and built the solution. We should go and update the Plugin package.

  • To update the Plugin Package, in the ‘Plugin Registration Tool’, go to View ->Display by Package.
  • Select the latest .nupkg file and update.
  • Note : We have to go to View ->Display by Package to delete the package.
  • Test by creating a new Account record.

Limitations:

  • A plugin package is limited to 16 MB in size or 50 assemblies.
  • Workflow extensions, also known as workflow assemblies, workflow activities or custom workflow activities are not supported.
  • On-premises environments are not supported.

Known Issues:

  • Please refer Known Issues here
  • At the time of writing this article,
    • Asynchronous plug-in steps do not work. My Article on this issue.
    • You cannot use Plug-in Profiler to debug plug-ins that are part of a plug-in package.

Hope you got some idea about ‘Dependency Assemblies’. Happy learning 🙂

[Step by Step] Model Driven App | Grids | Navigate to custom page on row click

By default, performing any of the following grid actions opens the table record:

  • Double-clicking the data row, or selecting the primary column link in the row.
  • Selecting a data row, and then pressing the Enter key.
  • On a touch-enabled device, selecting a data row.

In this article, lets see how to override the default grid click behavior and navigate to a Custom Page. Same approach can be used to navigate to custom URL, show alert etc…

Before jump on to implementing override default behavior, lets understand how the same requirement can be achieved using ribbon button.

Conventional way of achieving this requirement:

Assume that you would want to redirect to custom url (i.e., Google, Bing, etc…) from the Main Grid. One common approach would be:

  • Add a custom jScript function with a desired navigation logic upload as a webresource.
  • Add a ribbon button on grid and map the jScript function.
  • Select the grid record(s) and click the button which will redirect you to the custom url.

In the above approach, the overhead is every time you have to select record in grid and click the ribbon button.

With the ‘override default behavior’ approach would be pretty much same except you don’t need to click the ribbon button everytime.

Using override default behavior:

Let me explain the override default behavior of main grid, by redirecting to a custom page on click of grid row by following these steps.

Create a custom page:
  • As we will be redirecting to a custom page on grid click, first lets create a custom page.
  • I’ve created a simple custom page with ‘Account Name’, ‘Account Number’ fields and a ‘Back’ button.
  • Copy the ‘Name‘ of the Custom Page, which we would using in the next steps.
  • Next, you must add your ‘Custom Page’ to the Model Driven App using editor.

Create a webresource:

We will be adding the navigation to ‘Custom Page’ logic in jScript function. If you want to navigate to custom url or display alert just put the appropriate logic in this jscript function.

  • Create a jScript file and copy following ‘openCustomPage‘ function.
    • Set ‘name’ as the ‘Name‘ of the Custom Page copied in previous step.
  • Save this jScript file as a webresource.

Create a new ribbon button

We need to add a button in this ‘override default behavior’ approach as well but with slight changes.

The placement of the button is important. As we want to override the ‘Main Grid’ behavior, we need to add a new button on the ‘Main Grid’.

If you want to override the Contacts subgrid behavior on the Accounts form, you need to add the new button on to the contact form.

Lets use Ribbon Workbench to add a new button on ‘Account’ Main Grid.

  • Once you add a button, create a command definition with Mscrm.OpenRecordItem as the ID.
    • This is the key. The application looks for the Mscrm.OpenRecordItem command ID, when you try to open a record from the grid and if one is present, will execute the custom action instead of performing the default behavior of opening the table record.
  • Add a ‘Custom Javascript Action’ to the command and and include the CrmParameter with the value SelectedControlSelectedItemReferences.
  • Following is the ‘RibbonDiffXml’ for your reference.
<?xml version="1.0" encoding="utf-16"?>
<RibbonDiffXml xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CustomActions>
    <CustomAction Id="raj.Mscrm.OpenRecordItem.CustomAction" Location="Mscrm.HomepageGrid.account.MainTab.Management.Controls._children" Sequence="65">
      <CommandUIDefinition>
        <Button Alt="$LocLabels:Mscrm.OpenRecordItem.Alt" Command="Mscrm.OpenRecordItem" Id="Mscrm.OpenRecordItem" LabelText="$LocLabels:Mscrm.OpenRecordItem.LabelText" Sequence="65" TemplateAlias="o3" ToolTipTitle="$LocLabels:Mscrm.OpenRecordItem.ToolTipTitle" ToolTipDescription="$LocLabels:Mscrm.OpenRecordItem.ToolTipDescription" />
      </CommandUIDefinition>
    </CustomAction>
  </CustomActions>
  <Templates>
    <RibbonTemplates Id="Mscrm.Templates" />
  </Templates>
  <CommandDefinitions>
    <CommandDefinition Id="Mscrm.OpenRecordItem">
      <EnableRules />
      <DisplayRules />
      <Actions>
        <JavaScriptFunction FunctionName="openCustomPage" Library="$webresource:raj_account_js">
          <CrmParameter Value="SelectedControlSelectedItemReferences" />
        </JavaScriptFunction>
      </Actions>
    </CommandDefinition>
  </CommandDefinitions>
  <RuleDefinitions>
    <TabDisplayRules />
    <DisplayRules />
    <EnableRules />
  </RuleDefinitions>
  <LocLabels>
    <LocLabel Id="Mscrm.OpenRecordItem.LabelText">
      <Titles>
        <Title description="Open Record Item" languagecode="1033" />
      </Titles>
    </LocLabel>
  </LocLabels>
</RibbonDiffXml>

Note: You can enable or disable the newly created button; doing either will still override the open default behavior.

  • Publish the Ribbon changes.
  • That’s all needed. If you notice in both ‘conventional’ and ‘override default behavior’ approaches, the ribbon button is common but the ‘override default behavior’ does not require you to explicitly click the button.

  • Refer this Microsoft Docs article for more details.

🙂

[Step by Step] Power Apps portals | Version Control website using Power Platform CLI

In this article, lets see how to version control the Portal website components using Power Platform CLI Portal commands.

What is Version Control

  • Version control, also known as source control, is the practice of tracking and managing changes to software code.
  • Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.

Lets start working with Portal CLI with prerequisites.

Prerequisites:

Before we jump on to CLI, lets see how portal components can be edited from maker portal.

Edit Portal Website from Maker Portal

Once your Portal application created

  • Click on the portal app.
  • You will be redirected to your portal website as shown below.
  • If you notice, portal website is collection of many components (i.e., Web Pages, Lists, Files, etc…). You can edit the web site by using ‘Edit’ option directly from maker portal.
  • You will be redirected to Portal editor and can edit the components.

Challenges with editing Website directly from Maker Portal

As detailed in above section, you can edit the website directly from Maker Portal but at the cost of following challenges.

  • Its not version controlled. Meaning, if I want to revert a file with content from last stable release, it not possible with out version control.
  • As a Pro developer, you would feel comfortable editing webpage as html file than in the portal editor.

Use Power Platform CLI with portals

Lets see how we can solve versioning using CLI.

  • Open a new ‘Terminal’.
  • As a first step, you need to connect to your Dataverse environment by executing following command.
    • pac auth create -u {Environment_url}
  • Get the list of available Portals by executing following command.
    • pac paportal list
  • Copy the ‘WebSiteId’ as highlighted above.
  • Now download the website components using following command.
    • pac paportal download –path [PATH] -id [WebSiteId]
  • Website contents gets downloaded and saved locally as below.
  • Now, open this folder using VSCode and open the components.
  • Lets go ahead and edit the ‘Home’ web page content.
  • Upload the modified website components using following command.
    • pac paportal upload –path [Folder-location]
  • The upload only happens for content that’s been changed. In the above example, since the change is made to a webpage, content is uploaded only for the adx_webpage table.
  • Now, lets refresh the portal website and you should see the modified text.
  • If you dont see the changes, you can clear the server-side cache as below.
    • Navigate to the URL as follows: <portal_path>/_services/about.
    • Select Clear Cache.

Advantages of CLI for portals development

  • We can commit the website components to any of the version control tools like Azure DevOps, GitHub.
  • We can now use offline-like capability for portals customization by making changes to the portals content. And once all customizations or changes are saved, upload them to the portal.
  • Helps integrate seamlessly with any source control tools, such as “git”
  • Easily set up CI/CD pipelines

Limitations

  • Portals support for Power Platform CLI is limited to the tables listed here.

🙂

Categories: Portals Tags: , ,

Power Apps | Application Insights | Query Telemetry data

Recently while troubleshooting as issue which was only occurring for a particular user, there was this question from a customer on “Determining how this user is accessing their system”.

To simplify the question, assume that you have a Model Driven App and end users might access it from following modes and you need to determine using which mode a particular User accessed the application in last 24 hours.

  • Different browsers
  • Plug-in Registration
  • XRMToolBox
  • Powerautomate
  • Postman
  • etc…

Coming back to troubleshooting, since the issue occurring for only a User, it would be a great help to fetch User access details like (Client OS, Region, Host Type, User Agent etc…) to narrow down the issue and provide fix.

In this article lets see how Application Insights telemetry data helps us troubleshoot issues related to application slowness, intermittent issues and many more.

Prerequisites:

Once the prerequisites are fulfilled, we need to set up Applications Insights for Power Platform environment.

Configure Application Insights for Power Platform Environment:

  • Set up export to your Applications Insights environment from the Power Platform admin center. Steps mentioned here.
  • Typically, one production environment or tenant maps to one Application Insights environment.
  • Post data export connection set up. Data will start being exported to your Application Insights environment, In the next 24 hours,.

Access the Application Insights Telemetry Data:

To access the Application Insights data

  • Connect to your Azure Portal.
  • Open the ‘Application Insights’ environment which you mapped to your Power Platform environment in the above section.
  • Under Monitor -> Logs, Run the Kusto queries.

Before jump on executing the queries, I highly recommend you to go through Telemetry-events-model-driven-apps and Telemetry-events-dataverse.

pageViews table
  • Application Insights page load data goes into the pageViews  table.
  • We need to query pageViews  table to fetch the Page load/User access related data.
  • Below is a sample query to pageViews table.

How to fetch the user access details.
  • To determine how the user is accessing the system, The userAgent attribute in the customDimensions field in the Application Insights pageViews table has this data.
  • Use the following query to get an overview of the different sources from where users are accessing the system:
pageViews
| summarize count() by tostring(customDimensions.userAgent), user_Id

dependencies
| where ['type'] == "UCI REQUEST"

Using the ‘Session ID’ to troubleshoot slowness or load issues:

  • Users can share their session ID from the About section of the App.
  • You can then use this ID to find issues by looking at all the activities in that session. Use the following query:
union *
| where session_Id == '[sessionIdHere]'

🙂