Sunday, 13 September 2015

Plugin/Workflow to Validate Business Process Flow in CRM 2015

Hi,

Most of the times we get requirement to validate the user on clicking Next stage or previous stage. This can be easily done by workflow.

1) Just create a real time workflow by following the below steps.
2) Select Process Stage (StageId) from Record Field Changes
3) Check the condition from Process Stage, add your conditions here along with the stage you wanted to validate.
4) Stop the workflow with the message.

Output

In my requirement, I wanted to validate some with the current stage and previous stage. Normally for this type of things we go with Plugin by adding a pre-image.

I tried the same to register the plugin, unfortunately the plugin registration tool is not showing any fields that are related to Process
to select in the Filtered Attributes.
However, we have a fix for this.

1) Use Developer toolkit for creating a plugin and registering.
2) Register the plugin on update and select any field whichever you want. I did select 'name' in this example.
 
3) The toolkit prepares Register XAML for you. Now, go ahead and change the field name to stageid and deploy the solution.
4) In the same way, you can also register PreImage and PostImage.

Here is my code in the plugin.

Output

Note: Currently this is working only Online CRM and working on OnPremise with issues like Business Process Flow shows two active stages, after validating users are not allowed to modify anything until they refresh the page etc..

We will have wait for Ara release to get the issue fix. Will update this post soon.

Hope this helps.
--
Happy CRM'ing

Gopinath
 

No comments:

Post a Comment