Set Business Process Flow Stage using Custom Workflow Activities in CRM 2013/2015

  1. Business Process Flow ensures that every time the user works with a customer they follow the same steps and enter data consistently. To move from one stage to another, user has to enter the information/fields required per stage and then click on “Next Stage”.

If the users like to change the Business Process Flow stage dynamically then this can be done by creating a custom workflow activity and use it in a workflow.

  1. Create a custom workflow activity from visual studio that accepts “Stage Name” as an input parameter

             

      2.   Write the following code in Execute

           

      3.   Create a workflow with the following details (i.e. add a step to call our custom workflow activity)

            

             

              

Comments

  • Anonymous
    June 24, 2015
    Hi, There's something bad about this code... I'm just reading and I can see your not using the StageName at all, so in my opinion you're not setting the Stage that you receive by parameter... your setting the fisrt Stage of the process. Am I right?

  • Anonymous
    January 15, 2016
    Johann - I believe you're correct. Not only is it not using the stage name, its setting the stageid to the workflowid. The workflowid should be assigned to the processid, and the stageid should be coming from an entity of type "processstage", not "workflow" as this example shows. This more accurately shows how to set the processid.