Citizen Developer
Timespan
explore our new search
Best Practices for Dataverse Plugins & Custom Workflow Activities
Microsoft Dataverse
Oct 11, 2023 1:00 PM

Best Practices for Dataverse Plugins & Custom Workflow Activities

by HubSite 365 about Softchief Learn

Learn how to take advantage of your business data with Microsoft Dynamics 365 & Power Platform & Cross Technologies. My name is Sanjaya Prakash Pradhan and I am a Microsoft Certified Trainer (MCT) and

Citizen DeveloperMicrosoft DataverseLearning Selection

Become a microsoft expert with our top 14 best practices for plugins & custom workflow activities in Dataverse - a must for power apps developers.

Microsoft Dataverse: Top 14 Practices for Plugins & Custom Workflow Activities

In a detailed video tutorial on custom workflow activities and plugins, 'Softchief Learn' shares valuable insights on how to operate with Microsoft Dataverse effectively. Some highlights include the facilitation of the creation and execution of custom workflow activities which go beyond the default framework provided by Windows Workflow Foundation.

The Windows Workflow Foundation provides a host of out-of-box activities, like control flow, sending and receiving messages, and working with parallel data. However, in order to fulfill specific business needs, Microsoft Dataverse enables the integration of custom workflow activities to perform tasks specific to an application. The workflow designer within Microsoft Dataverse enables the addition of extensions, called workflow assemblies.

Workflow extensions come into play when a declarative process does not meet specific business requirements. If the default process activities don’t fulfill the functionality requirements, custom activities can be added to the editor. It is recommended to apply one of the numerous declarative options first before considering these extensions to define business logic.

Creation of Plugins

There are two methods to create plug-ins: using Power Platform development tools or manually writing code. The Power Platform Tools for Visual Studio and Power Platform CLI provide a modern way to develop plugins. A basic plugin project with template plugin code can be created using a simple command, and the plugin is registered using Plug-in Registration tool.

Microsoft Dataverse enables interaction with plug-ins using IPlugin interface. The plug-ins are basically a compiled class within an assembly built to target .NET Framework 4.6.2. A plug-in class implementing the IPlugin interface has to have the Execute method.

The Execute method, accepting one IServiceProvider parameter, supports the use of several service types. When deriving from the IPlugin interface, it is advised to write the class as stateless for platform performance and caching reasons.

Tracing and Configuration

At the time of plugin registration, the user has the option to specify configuration data for the plug-ins. This allows custom behavior for specific instances of registered plugins. Two types of data - unsecure and secure configuration data, can be passed as string data to parameters.

The author also provided a comprehensive overview of how you can use the IServiceProvider.GetService method to access services. The execultion context, Organization web service, and Tracing service were discussed in this section of the video.

Performance and Assembly Constraints

The video gives caution about performance aspects of plugin design. Efficient and quick execution of plug-ins is critical to maintain a responsive application UI. The assembly constraints such as Plug-in and custom workflow activity assembly projects must target .NET Framework 4.6.2 are highlighted.

Plug-in assemblies must be signed before they are registered. Certain other aspects like dependency on System.Text.Json, and dependent assembly capability were also discussed. After building the assembly, you can register the plug-in and then debug it for any potential issues.

In a nutshell, the video serves as a comprehensive guide to enhance the efficience of workflows in Microsoft Dataverse, it is replete with best practices and guidance on the development of plug-ins and workflows.

Learn about Top 14 Best Practices for Plugins & Custom Workflow Activities in Dataverse

The knowledge of integrating plugins and workflow activities on Dynamics 365 Customer Engagement CRM is a fundamental competency one must master. Training courses on Microsoft Dataverse (previously known as Common Data Service) are your stepping stone to understanding this domain and the various plugins and custom workflow activities it offers.

For starters, the capability of Dataverse to register and execute custom workflow activities beyond the out-of-box activities provided by Windows Workflow Foundation is a main feature. To add to this, the custom activities perform tasks that cater to the precise needs of the application you are working on.

Windows Workflow Foundation includes a vast library of activities for control flow, sending and receiving messages, doing work parallelly, and more. However, to tackle application-specific tasks, one often needs to create custom workflow activities. Dynamics 365 offers space for such custom workflow creation.

Your journey in mastering plugins and workflow activities necessitates the knowledge of assemblies. In the Dynamics 365 universe, plug-ins are custom business logic that integrates with the CRM system to modify or extend the standard behavior of the platform.

A crucial aspect of learning is gauging when to create a workflow extension. For example, if the functionality required is not available using the default process activities, custom activities could be added, making them available in the workflow, dialog, and action process editors.

Another critical area to focus on is how to create plug-ins. Power Platform development tools offer a contemporary approach to create plug-ins and Power Platform Tools for Visual Studio and Power Platform CLI are two toolsets that the training should focus on.

Alongside creating plugins, the capability to register or deploy plugins is an added advantage. Learn using Power Platform Tools for Visual Studio for quickly creating and registering plugins. For those who prefer working in a terminal window or Visual Studio Code, using Power Platform CLI could be an option.

Using and writing IPlugin interface is also important when working with plugins. Each class in a plugin project registered on an event pipeline step must execute the IPlugin interface, which defines a single IPlugin.Execute method.

You will also need to learn how to pass configuration data to your plugin and to handle the services you can use in your code. These are key aspects in working with plugins as it allows you to control how your plugin should behave.

A deep understanding of plugin-design impacts on performance is mandatory. As the time it takes for your plugin to execute directly affects the end user, it’s pivotal that it execute efficiently and quickly. You must also learn how to use early-bound types in plugin code and the intricacies of building a plugin assembly.

Another critical lesson is to optimize assembly development and ensure that each assembly is signed before registration. Other aspects to consider during your training would be dependency on assemblies that don't interact with low-level Windows APIs and those on non-Dataverse assemblies.

The final stages of the training will focus on registering a plugin and debugging them. Lastly, best practices and guidance regarding plugin and workflow development is the cherry on top. This concludes an all-encompassing training program, and with it, you should achieve mastery in integrating plugins and custom workflow activities for Microsoft Dataverse.

Keywords

Best Practices for Plugins, Custom Workflow Activities, Dataverse, Plugins in Dataverse, Workflow Activities in Dataverse, Dataverse Best Practices, Custom Activities in Dataverse, Dataverse Plugins, Dataverse Workflow Activities, Dataverse Custom Activities