Citizen Developer
explore our new search
Move BPF Stages with Plugin via Dataverse Record Field Change
Microsoft Dataverse
Oct 22, 2023 2:30 AM

Move BPF Stages with Plugin via Dataverse Record Field Change

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

Discover how to automate BPF stage movements using a CRM Plugin in this Microsoft Expert guide on Dynamics 365 Customer Engagement CRM and Dataverse.

The YouTube video presented by "Softchief Learn" provides instructions on a Microsoft Technology, to be precise how to automatically move stages in the Business Process Flow (BPF) using plugins with a related record field value change in Dynamic 365 Customer Engagement.

To set the stage, the author explains that in some scenarios, we need to automatically move BPF Stages based on server-side code. The CRM Plugin can achieve this automation. The video guides us through the process using an example of updating a title for a selected record and observing the automatic advancement to the next stage.

The walkthrough consists of several steps, starting with logging in to the desired environment and checking whether the BPF, titled "Vaccination", in this example is active or not. The logical name of the BPF is then recorded for future reference.

The next steps detail the process of implementing plugin code, a C# Class Library, into the program. This begins with setting parameters for an update message to the 'contact' for a 'jobtitle' field change. If this condition is met and the 'jobtitle' field is not null, the logic inside the code block is then executed.

How to trigger the plugin on any Business Process Flow ...
using our plugin we are changing the status of the related Employee Stages entity record named Screening to Active.

With the code executed, the process then involves getting the active BPF details currently on the selected contact record. The process continues with acquiring all the stages of the selected BPF and extracting the next stage ID details. The next stage is then set active as an object of the current BPF, and the 'activestageid' of BPF is updated.

The final chunk of code is a compilation of all prior steps, brought together to function in unison. The author stresses the importance of including generic and specific exceptions, such as invalid exceptions, in the exception block. Finally, the assembly is registered using the Plugin registration tool, and an update step is created on the 'contact' entity.

In the end, the author concludes by emphasizing that CRM Plugin code can be used to automate BPF Stages according to business requirements.


Deeper Analysis into Microsoft Dataverse

Microsoft Dataverse, commonly known as Dynamics 365, provides a secure and scalable data service to be leveraged by developers for building applications. It's essentially a set of tools that allow administrators and developers to manage and manipulate data, which forms the backbone of various applications.

One major advantage of Microsoft Dataverse is its adaptability to integrate with Microsoft products like Office 365, Azure, and others. This adaptability ensures smooth and seamless data flow and management across the applications. It also provides a unified and consistent platform to develop, deploy, and manage business applications helping to increase productivity.

To enhance your understanding of Microsoft Dataverse, click here.


Learn about Automatically Move Stages in BPF using Plugin with Related record field value change in Dataverse


The following tutorial discusses how to use Microsoft Dataverse to automatically transition stages in Business Process Flows (BPFs) using Plugins. This process is pertinent when using Dynamics 365 Customer Engagement CRM. Please note: avoid using the term Microsoft Dataverse excessively in this tutorial. We will refer to it as 'the database' or 'the CRM platform' from now on.

Firstly, you’ll need to log in to your relevant environment and go to the ‘flows’ section. Make sure your desired BPF – in this case ‘Vaccination’ – is active. If it isn't, you'll need to activate it.

Afterwards, open the BPF and take note of its logical name for future use.

Following that, navigate to your plugin code and locate the 'execute' method associated with updating the 'jobtitle' field. Here, you need to add your logic inside the code block. This block will execute automatically when the title field of the selected contact record is updated, effectively moving the BPF to the next stage.

The next steps will focus on obtaining details about currently active BPF stages and next stage IDs.

You will need to extract details of the BPF that is active in the selected contact record. To do this, you will use the 'RetrieveProcessInstancesRequest' present in the CRM SDK messages. You will then select the first instance from the list of BPF process instances.

Next, to get the details of all the stages of the BPF on the contact record, you can utilize the 'RetrieveActivePathResponse' message. You will also need to extract information about the current Stage Position and the next stage ID.

Notably, the next stage ID will be needed to update the active stage of your BPF. With the 'IOrganizationService' update, your BFP will automatically move to the next stage.

An important detail to mention is that it's possible to include restricting access based on roles and other transactions, tailored to your specific needs, within the 'execute' method. Be sure to handle both generic and specific exceptions for efficient error handling.

Overall, the process of writing CRM Plugin code to automatically move BPF Stages is dependent on the given business requirements, and highly customizable.

To learn more about this process, it recommendable to undertake training courses on Microsoft Plugins and Business Process Flows, part of the Dynamics 365 Customer Engagement CRM. These courses will provide more guidance on using CRM SDK messages and deep dive into the coding aspect of the CRM platform and plugins.

Understanding the integration of various components and how to manipulate codes to fit custom requirements, will better your grasp of the overall platform and strategies to maximize utilization. Several resources and platforms offer such courses; ensure to pick one that best suits your learning style and comfort.



Dataverse Plugin, BPF Automated Stage Movement, BPF with Related Record, Dyn365 BPF Automation, Plugin Development, Custom Workflow BPF, Business Process Flow Automation, Field Value Change Tracking, Dynamics CRM Plugin, Value-Based BPF Dataverse.