Microsoft Dynamics CRM 2013 introduced the concepts of Business Process Flows. For any entity which have business process flows enabled, CRM creates two fields in the entity
1. stageid
2. processid
On Change of process or stage for an entity, CRM allows you to register workflows. However through plugin registration tool, it is not possible to register plugins on change of stage or process. Also in images for steps you cannot add the processid and stageid parameters during update/ post create of the entity. You have to write separate queries altogether to fetch the processid and stageid for an entity during create/ update of entity in the plugins.
However there is workaround which helps you to achieve all of this in a very simple manner. Let’s see how this can be achieved.
CRM 2013/ 2011 SDK ships with the developer toolkit. Once you install the developer toolkit and open visual studio, you get an option to create CRM Solution. Check for the screenshot below.
Just select that and CRM creates a solution for you with the Plugins Class library and also a special type of project called ‘CrmPackage’
Using the CRM Explorer, I have created a plugin on post update of Opportunity.
Once the plugin is created, open the RegisterFile.crmregister file in the CRMPackage project. As you can see i have manually added stageid in the filtering attribute and stageid and processid in the post image.
All you now need to do is right click the CRMPackage project and select “Deploy” from the menu.
once deploy is succeeded, open Plugin registration tool and you should be able to see the changes.
Now as you change the stage of the opportunity, you can see that the plugin is fired and we are able to get the processid and the stageid in the post image.
Hope this helps!
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.