Maximizing Your Power Platform Solution’s Reach: Essential Performance Considerations for Optimal Efficiency

Hi Folks,

This blog post is all about performance considerations for your Power Platform CE Projects and how you can plan to optimize application performance for your Power Apps. So I just want to take you through them…

Are you tired of creating solutions for longer durations and while at the end of the project or during UAT you end up facing performance issues for the solutions you have developed, one of the most important non-functional requirements for a project’s success is Performance. Satisfying performance requirements for your users can be a challenge. Poor performance may cause failures in user adoption of the system and lead to project failure, so you might need to be careful for every decision you take while you design your solutions in the below stages.

Let’s talk about them one by one..

1. Network Latency and bandwidth

A main cause of poor performance of Dynamics 365 apps is the latency of the network over which the clients connect to the organization. 

  • Bandwidth is the width or capacity of a specific communications channel.
  • Latency is the time required for a signal to travel from one point on a network to another and is a fixed cost between two points. And usually many of these “signals” travel for a single request.

Lower latencies (measured in milliseconds) generally provide better levels of performance. Even if the latency of a network connection is low, bandwidth can become a performance degradation factor if there are many resources sharing the network connection, for example, to download large files or send and receive email.

Dynamics 365 apps are designed to work best over networks that have the following elements: 

  • Bandwidth greater than 50 KBps (400 kbps)
  • Latency under 150 ms

These values are recommendations and don’t guarantee satisfactory performance. The recommended values are based on systems using out-of-the box forms that aren’t customized.

If you significantly customize the out-of-box forms, it is recommend that you test the form response to understand bandwidth needs.   

You can use the diagnostics tool to determine the latency and bandwidth:

  1. On your computer or device, start a web browser, and sign in to an organization.
  2. Enter the following URL, https://myorg.crm.dynamics.com/tools/diagnostics/diag.aspx, where crm.dynamics.com is the URL of your organization.
  3. Click Run.

Also, to mitigate higher natural latency for global rollouts, customers should leverage Dynamics 365 Apps successfully by having smart design for their applications. 

2.Smart Design for your application

Form design 

  • Keep the number of fields to a minimumThe more fields you have in a form, the more data that needs to be transferred over the internet or intranet to view each record. Think about the interaction the user will have with the form and the amount of data that must be displayed within it.
  • Avoid including unnecessary JavaScript web resource librariesThe more scripts you add to the form, the more time it will take to download them. Usually, scripts are cached in your browser after they are loaded the first time, but the performance the first time a form is viewed often creates a significant impression.
  • Avoid loading all scripts in the Onload eventIf you have code that only supports OnChange events for fields or the OnSave event, make sure to set the script library with the event handler for those events instead of the OnLoad event. This way loading those libraries can be deferred and increase performance when the form loads.
  • Use tab events to defer loading web resourcesAny code that is required to support web resources or IFRAMEs within collapsed tabs can use event handlers for the TabStateChange event and reduce code that might otherwise have to occur in the OnLoad event.
  • Set default visibility optionsAvoid using form scripts in the OnLoad event that hide form elements. Instead set the default visibility options for form elements that might be hidden to not be visible by default when the form loads. Then, use scripts in the OnLoad event to show those form elements you want to display. If the form elements are never made visible, they should be removed from the form rather than hidden.
  • Watch out for synchronous web requests as they can cause severe performance issues. Consider moving to asynchronous for some of these web requests. Also, choose WebApi over of creating Xml HTTP Requests (XHR) on your own. 
  • Avoid opening a new tab or window and do open the window in the main form dialog. 
  • For Command Bar, keep the number of controls to a minimumWithin the command bar or the ribbon for the form, evaluate what controls are necessary and hide any that you don’t need. Every control that is displayed increases resources that need to be downloaded to the browser. Use asynchronous network requests in Custom Rules When using custom rules that make network requests in Unified Interface, use asynchronous rule evaluation.

Learn more Design forms for performance in model-driven apps – Power Apps | Microsoft Learn

Latest version of SDK and APIs 

The latest version of SDK, Form API and WebAPI endpoints should be used to support latest product features, roadmap alignment and security. 

APIs calls and custom FetchXML call velocity 

Only the columns required for information or action should be included in API calls

  • Retrieving all columns (*) creates significant overhead on the database engine when distributed across significant user load. Optimization of call velocity is key to avoid “chatty” forms that unnecessarily make repeated calls for the same information in a single interaction.
  • You should avoid retrieving all columns in a query result because of the impact on a subsequent update of records. In an update, this will set all field values, even if they are unchanged, and often triggers cascaded updates to child records. Leverage the most efficient connection mechanism (WebAPI vs SDK) and reference this doc site for guidance on the appropriate approach.

Consider reviewing periodically the Best practices and guidance when coding for Microsoft Dataverse – Power Apps | Microsoft Learn and ColumnSet.AllColumns Property (Microsoft.Xrm.Sdk.Query) | Microsoft Learn.

Error handling across all code-based events 

You should continue to use the ITracingService.Trace to write to the Plug-in Trace Log table when needed. If your plug-in code uses the ILogger interface and the organization does not have Application Insights integration enabled, nothing will be written. So, it is important to continue to use the ITracingService Trace method in your plug-ins. Plug-in trace logs continue to be an important way to capture data while developing and debugging plug-ins, but they were never intended to provide telemetry data.  

For organizations using Application Insights, you should use ILogger because it will allow for telemetry about what happens within a plug-in to be integrated with the larger scope of data captured with the Application Insights integration. The Application Insights integration will tell you when a plug-in executes, how long it takes to run and whether it makes any external http requests. Learn more about tracing in plugins Logging and tracing (Microsoft Dataverse) – Power Apps | Microsoft Learn.   

Use Solution Checker to analyze solution components 

Best practice is to run Solution Checker for all application code and include it as mandatory step while you design solutions or check when you complete developing your custom logic.

Quick Find 

For an optimal search experience for your users consider the next:

  • All columns you expect to return results in a quick find search need to be included in the view or your results will not load as expected.
  • It is recommended to not use option sets in quick find columns. Try using the view filtering for these. 
  • Minimize the number of fields used and avoid using composite fields as searchable columns. E.g., use first and last name as searchable vs full name.
  • Avoid using multiple lines of text fields as search or find columns.
  • Evaluate Dataverse search vs using leading wildcard search

3. Training

This step should be done during user training or during UAT. To ensure optimal performance of Dynamics 365, ensure that users are properly leveraging browser caching. Without caching, users can experience cold loads which have lower performance than partially (or fully) warm loads.

 Make sure to train users to: 

  • Use application inline refresh over browser refresh (should not use F5)
  • Use application inline back button instead browser’s back button.
  • Avoid InPrivate/Incognito modes in browser which causes cold loads.
  • Make users aware that running applications which consumes lot of bandwidth (like video streaming) may affect performance.
  • Do not install browser extensions unless they are necessary (this might be also blocked via policy)
  • Do use ‘Record Set’ to navigate records quickly without switching from form back to the list. 

4. Testing

For business processes where performance is critical or processes having complex customizations with very high volumes, it is strongly recommended to plan for performance testing. Consider reviewing the below technical talk series describing important performance considerations, as well as sharing practical examples of how to set up and execute performance testing, and analyze and mitigate performance issues. Reference: Performance Testing in Microsoft Dynamics 365 TechTalk Series – Microsoft Dynamics Blog

5. Monitoring

You should define a monitoring strategy and might consider using any of the below tools based on your convenience.

  1. Monitor Dynamic 365 connectivity from remote locations continuously using network monitoring tools like Azure Network Performance Monitor or 3rd party tools. These tools help identify any network related problems proactively and drastically reduce troubleshooting time of any potential issue. 
  2. Application Insights, a feature of Azure Monitoris widely used within the enterprise landscape for monitoring and diagnostics. Data that has already been collected from a specific tenant or environment is pushed to your own Application Insights environment. The data is stored in Azure Monitor logs by Application Insights, and visualized in Performance and Failures panels under Investigate on the left pane. The data is exported to your Application Insights environment in the standard schema defined by Application Insights. The support, developer, and admin personas can use this feature to triage and resolve Telemetry events for Microsoft Dataverse – Power Platform | Microsoft Learn
  3. Dataverse and PowerApps analytics in the Power Platform Admin Centre. Through the Plug-in dashboard in the Power Platform Admin Center you can view metrics such as average execution time, failures, most active plug-ins, and more.
  4. Dynamics 365 apps include a basic diagnostic tool that analyzes the client-to-organization connectivity and produces a report.
  5. Monitor is a tool that offers makers the ability to view a stream of events from a user’s session to diagnose and troubleshoot problems. Works both for model driven apps and canvas apps. 

I hope this blog post had helped you learn or know something new…thank you for reading…

Cheers,

PMDY

Track the Power Platform blog feed…Insight

Hi Folks,

Hope you were having a fantastic year….

By the way, in this blog post, I would like to give a bit of detail how to record new posts in any of the tech blogs mainly for your favorite power platform ones coming from Power Platform Tech Guru’s directly in your team’s channel without navigating away. This helps you to upskill or learn a new topic fast. Pshhh..at least for some.

All you need is a teams license and a RSS enabled blog address to get the feed…all WordPress blogs are RSS Enabled by default.

Ok, let’s get started….

Open Microsoft Teams

In the left pane, select Apps icon and search for RSS

Click on RSS in the search and choose Add to a team as below.

Next step is to select the channel..

Then choose Set up a connector as below

Key in the details of the feed…here for sake of simplicity, I am giving this blog feed…so see snap below, same time you can set the frequency and you get updates from your feed.

Next step is to just save the feed details….and once saved you can something like below…

That’s it, you will be notified each time a blog is published directly to your teams channel and all the feed for the blog will be available right in in Team’s channel as below. How great is it….

This is not a power platform related blog post actually but this tip can greatly enhance your learning in your workplace without getting distracted.

Hope this helps…

Cheers,

PMDY

Email templates showing Xml – Quick Tip

Hi Folks,

We recently came across a situation where the new and existing email templates keeps showing a xml as below.

This kept us annoying as already the existing ones are created using Rich Email Template editor. At first check, we verified in our Dev and SIT, badly we saw that this is same in both the environments. We double confirmed that no changes were made to the OOB Email template form, so we doubted that there was something wrong with our environment. Luckily we have one more environment where we able to see the email templates working fine. Then we confirmed that there is related to email template form related issue. Also when we tried to open the existing email templates in new designer from https://make.powerapps.com, they opened without any issue.

Fix: Open your model driven app in your custom solution created and launch it by double clicking on it. Just verify it the forms selected for Email Template entity….

The fix is quite obvious and there you are..inorder for email template to show properly, you should select Default UCI Template type form.

Voila, its back as below.

Hope this useful…

Cheers,

PMDY

ChatGPT – Insights

Hi Folks,

In this modern era where AI/ML is ruling the world and automating all the possible day to day activities done by a human, in this blog article, let’s talk about the latest buzz word since November 2022. i.e. ChatGPT.

So, what is ChatGPT, why its has become so much popular?

Officially ChatGPT stands for Generative PreTrained Transformer, it’s an AI-powered chatbot created by OpenAI. ChatGPT was fine-tuned on top of GPT-3.5 using supervised learning as well as reinforcement learning using Microsoft’s neural network technology. Open AI’s Chat GPT uses powerful machine learning algorithms to generate coherent and natural-sounding responses for user queries. To some extent, its giving a tough competition to its competitor Google Deep Mind Sparrow. The differences between the two can be found here.

The AI race between Microsoft and Google has definitely been ignited. Microsoft’s recent $10 billion investment into OpenAI, the startup behind their popular Chat GPT chatbot, has increased competition for AI supremacy.

Ok, that’s all the sleek intro. Let’s see how to work on this Chat GPT.

It can be accessed here

Once you click on the above link, you need login either with your Google or Microsoft credentials. You will be presented with below screen.

In the text box available at the bottom, you can enter your input for ChatGPT to search and get back the result to you.

I have just tried entering how we can integrate Open AI’s ChatGPT and Power Automate and results are pretty much shown in a manner which is easier to understand as below.

The interesting part compared to Power Platform’s Power Virtual Agents is that ChatGPT has the capability to record the previous responses used under the login which is a great enhancement. So with this, the problems can be analyzed and solutions can be generated. By the way, the GPT-3 model, in particular, is 175 billion parameters in size, making it the largest language model ever trained.

In the upcoming blogs, I will try to elaborate how Chat GPT can be used for Power Platform real world scenarios and how we can integrate with Power Automate step by step…. Till then stay tuned…and keep rocking….

Cheers,

PMDY

Connect to your instance via C# for validation – Works for Dynamics 365 latest versions

Hi Folks,

Every now and then when we were struck up with the issues with our code or with any power platform components like Power Automate, we had to definitely understand whether it is working from normal C# console application.

There were tons of articles over the internet and just it’s ophhhh…

So this post is just for a quick reference to connect to Dynamics 365 CE Instance to check if your actual function is returning valid data or not. I have just removed my functions for brevity.

You can just specify your Client Id, Client Secret, Instance URL below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Tooling.Connector;
using System.ServiceModel;

namespace TestConsole
{
internal class Program
{
static void Main(string[] args)
{

        IOrganizationService orgService = GetOrganizationServiceClientSecret(your client id, your client secret, instance url);
        var response = orgService.Execute(new WhoAmIRequest());//To validate the request

        if(response != null)
        {
            Console.WriteLine("Connected to CRM");

            //Your function here
        }
    }

    public static IOrganizationService GetOrganizationServiceClientSecret(string clientId, string clientSecret, string organizationUri)
    {
        try
        {
            var conn = new CrmServiceClient($@"AuthType=ClientSecret;url={organizationUri};ClientId={clientId};ClientSecret={clientSecret}");
            return conn.OrganizationWebProxyClient != null ? conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error while connecting to CRM " + ex.Message);
            Console.ReadKey();
            return null;
        }
    }
}

}

Whenever you want to check any thing from C# Console, I hope this piece code works for connecting to your Dynamics.

Cheers,

PMDY

Top 100 CRM blogs on the Planet for the year 2020

Hi Folks,

I am extremely happy to share that my blog is 75th in the list of best CRM blogs on the planet ranked by Feed spot.

Thank you for the readers and I will continue to contribute to the community through my blog going ahead.

https://blog.feedspot.com/crm_blogs/

Top 100 image from feedspot

Cheers,

PMDY

Enable logging in CE without any third party tools

Hi,

Have you ever had an issue where you need logging mechanism to troubleshoot…

Out there we have some 3rd party software which can help with this…but we can use Notes entity in CE so that we can enable logging to our .Net Assembly code with out any other 3rd party additions.

Add the below part to your code..

Entity _annotation = new Entity(“annotation”);
_annotation.Attributes[“mimetype”] = @”text/plain”;
_annotation.Attributes[“notetext”] = message;
service.Create(_annotation);

And use the method above to create log wherever needed like below..no other DLL additions required..you fill find the logs under Notes entity.

createlog(service, “Your String to be logged”);

Hope this helps while troubleshooting…

Cheers,

PMDY

Advanced Find Layout Problem – Quick Fix

Hi Folks,

Some day or the other you might encounter this problem…

I faced it again today, so just want to keep this post as quick reference…

When you open Advanced Find in any Model Driven App especially in old UI, suddenly this screen keeps popping up which is due to caching issues in your browser.

Screen will look weird as below….

Capture for blog

Fix:

  • Hit F12 in your Browser and find the Console tab in the window.
  • In the console window screen where the screen blinks…key in the below command and then press enter.
  • localStorage.clear()
  • Screen looks like as below…and good to proceed. Capture
  • Go ahead and refresh your browser page by pressing F5….there you go!!!

Cheers,

PMDY

Understand differences between System.Collections.Generic.List.Add() & System.Collections.Generic.List.AddRange()

Hi,

For now we will jump back to our C# Collections to gain some understanding…

Firstly whenever we would like to add just one element to the collection we use List.Add as below

List<OrganizationRequest> RequestCollection = new List<OrganizationRequest>();

OrganizationRequest class is provided in Microsoft.Xrm.Sdk namespace.

For this list of organization request collection…if we want to add an element..we can do like this where CreateRequest  is part of OrganizationRequest

CreateRequest transCreate = new CreateRequest { Target = orderTransaction };
RequestCollection.Add(transCreate);//Adding a create request

Suppose if we want to add multiple elements…we can use as below..

RequestCollection.AddRange(orderStarValue,totalRewardStars,salesOrder,orderDate);

Hope this helps..

 

Know more about enabling MFA…& it’s consequences…

Recently I was exploring about setting Multi Factor authentication for my Dynamics 365 Instance and connecting to it via code using Console applications. This is when I came know about using an App password for my Console application to work.

But do you know that based on the user states, MFA setup behaves differently..

Capture1

Ok..now let’s take a simple console application which just does nothing but connects using a OrganizationServiceProxy. Sample code can be found here.

  1. When MFA is disabled, you will be able to connect to the instance without any issues.

Capture1

2. Now Enable the MFA but don’t enforce it. Don’t sign in and complete the registration process of either providing pin or answering the call. Try to run the same console code above, you would be still able to connect without any issues.

Capture1

This is because Console application would also behave as non browser app. and will continue to work until the sign up is done exclusively as stated in the table above.

3. After the multifactor authentication is enforced, users will need to create app passwords for working with non browser applications. So now if you try to run the same Console application, you would get an error..

Capture2

Now sign in to your instance and generate the app password by providing additional security information when signing up. Use the same app password in place of credentials used while connecting to CRM in the console app.

And now you will be able to connect without issues…

Capture1

Hope this helps..

PMDY.