Skip to main content

Notifications

Dynamics 365 CRM Development Standards - Customization 3

Overview

This is Customization part 3 of a series of blogs introducing the Development Standards and Best Practices to help configure and customize CRM to do so consistently, clearly, and meaningfully.

Microsoft Flow and Plug-in

Introduction

D365 Plugins are custom code that executes in response to a specific event in the Dynamics 365 platform. Plugins can be used to automate complex business processes or to extend the functionality of Dynamics 365.

Workflows are a visual tool for building simple automation processes within Dynamics 365. So, it has a better performance. Workflows allow users to define a series of steps that are executed in response to a specific event, such as the creation of a new record. Workflows are easy to create and can be used to automate simple tasks, such as sending an email notification or updating a field on a record.

Microsoft Flow (Power Automate) is a cloud-based service that allows users to create automated workflows across multiple applications and services. Power Automate provides a wide range of connectors that allow users to integrate with popular applications such as Salesforce, Dropbox, and SharePoint. Power Automate also provides a visual interface for building workflows, making it easy for users to automate complex business processes.

In summary, D365 plugins are custom code that executes in response to complex events, workflows are a visual tool for building simple automation processes within Dynamics 365, and Power Automate is a cloud-based service that allows users to create automated workflows across multiple applications and services.

Best Practice

  1. If your scenario does not have significant complexity in terms of triggers and operating modes or it needs some sort of reconfiguration needed by non-developers periodically go for Workflow/Microsoft Flow else go for Plugins.
  2. Use the late bound and early bound in your Plugin.
  3. Limit the number of entities that you are generating in the early-bound/late-bound classes, to reduce the overall size of the assembly.
  4. The maximum size limit for a plugin assembly DLL in D365 online is 16 MB. If the DLL exceeds this limit, it cannot be uploaded to the system. It is recommended to keep the size of the DLL as small as possible by removing unnecessary code or dependencies. Additionally, it is a good practice to split large plugins into smaller ones to reduce the overall size.
  5. The maximum execution timeout for a Dynamics 365 Plugin is 2 minutes. If the plugin takes longer than 2 mins to execute, it will be terminated by the system.

To avoid hitting the timeout limit, optimizing the plugin code and reducing the processing time is recommended. For example, avoid external calls to web services.

  1. Don’t fetch All columns in your Retrieve request. Specific the columns which are needed.

For optimal performance, you should only select the minimum amount of data needed by your application when querying CRM data.

  1. AllColumnsproperty is ‘true’ means execute a SELECT * against the DB.  This scenario should be avoided whenever possible.

4572.pastedimage1681374140590v1.png8. Limit the number of attributes that trigger a Plugin Step by specifying the Filtering Attributes during registration.

7827.pastedimage1681374202402v2.png

9. Please throw InvalidPluginException instead of any other types of exceptions.

1884.pastedimage1681374244813v3.png

10. It's recommended to use Notes to keep track of changes after the system goes live for the first time. When you edit workflows, you should use the Notes tab and type what you did and why you did it.

 1425.pastedimage1681374272035v4.png

Not Recommended

  1. It is highly recommended not to store any sensitive information, such as username/password, clientId, or any credentials in Entity. Instead, use secure/unsecure configuration to pass this information to the plugin.

1680.pastedimage1681374351805v5.png

These “one or two” parameters are the multi-line text boxes indicated above. Information is exposed as string objects within your C# code and you enable this feature within your code by specifying the following, SDK adapted constructor within your Plug-in class:

public MyPlugin(string unsecureString, string secureString)

    {

        if (String.IsNullOrWhiteSpace(unsecureString) ||

            String.IsNullOrWhiteSpace(secureString))

            {

                throw new InvalidPluginExecutionException("Unsecure and secure strings are required for this plugin to execute.");

            }

 

            _unsecureString = unsecureString;

            _secureString = secureString;

    }
 

  1. It’s not recommended to register Plugin steps on frequently triggered messages. For example, avoid registering on the Retrieve/Retrieve Multiple messages. Since these messages are triggered frequently in Dynamics CRM, your plugin will run every time these messages are triggered.
  2. pre-image is not recommended and prefer using retrieve calls in plugins instead. Then we can avoid an internal row lock that degrades performance under increased load.

Please refer to this page for all the content. 

Dynamics 365 CRM Development Standards and Best Practices.

Comments

*This post is locked for comments