{Dynamics CRM Business Process Flow}Register Business Process Flow StageID and ProcessID in Plugins in CRM 2013

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.

screen 24

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.

screen 25

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.

screen 27

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.

screen 28

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.

screen 29

Hope this helps!

 

{Dynamics CRM Business Process} Change the Active Stage Flag in CRM 2013 Business Process Flows

Recently in our project, we had a customer requirement where the customer asked to change the colour of  image of active stage of a business process flow for Opportunity.

Let’s see how this can be achieved.

OOB in CRM 2013, the active stage flag for a business process in bluish is colour. Please check for the screenshot below.

screen 19

However, the customer wanted the flag to be in green to comply with their existing colour scheme. A little bit of exploring and we found that CRM picks up the image from the following location

<Installation Folder>\Microsoft Dynamics CRM\CRMWeb\_imgs\ProcessControl\process_control_global_active_flag.png

We took the .png image and modified the image using Photoshop to change the background colour to green keeping the dimensions exactly the same and then  replaced the old image with the new one. Recycle the app pool, clear your browser cache and refresh the page and the changes are reflected in the CRM. Check for the screenshot below.

screen 20

 

I would suggest you take a back-up of the original image before replacing the same. Also you have to do this as a part of your deployment once you move from dev–>test–>prod.

 

Hope this helps!