Tip #589: Programmatically Move Cross Entity Business Process Flow Stages in CRM 2016

It’s been a while since we’ve heard from Gayan “Not Daddy” Perera. As often the case with Gayan’s tips, this one is a nugget.

Moving the stage of a cross entity business process flow programmatically can be achieved by using the NavigateToNextEntity request. Most of the parameters are self explanatory, the only tricky one is the NewTraversedPath parameter (New! I knew it! We blogged about TraversedPath before and it did look promising – t.j.). This is a string value containing the previous stage id and the next stage id combined together with a comma.

Here is an example. Let’s say we have a case, the next step is to review the case email which will refer to the latest email from the customer. What we’re wanting to achieve is to automatically set this stage along with the email record reference so the user doesn’t need to click Next and then to select the Email record; eliminating two additional clicks.

OrganizationRequest or = 
   new OrganizationRequest("NavigateToNextEntity");
   new Guid("guid of the business process flow"));

   new Guid("guid of the next stage"));
   new Guid("{guid of the case}"));

   new Guid("{guid of the email}"));
   "previous stage guid,next stage guid");

var response = sdk.Execute(or) as OrganizationResponse;

Read more at the source.

3 thoughts on “Tip #589: Programmatically Move Cross Entity Business Process Flow Stages in CRM 2016

  1. tim says:

    Thanks for this.

    Can this method be used for progressing stages within the entity.

    Since branching (traversedpath) I can’t work out how to pro grammatically progress stages in C# (I now this can be done client side but this is not suitable for us) – any help would be appreciated.


  2. Thiago says:

    I tried to use that code in the plugin but got this error;

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: OrganizationServiceFaultDetail:





    the strange thing is, when I try to run that code in console application works well, only when I try to put it in update plugin message, the I got the error

Leave a Reply

Your email address will not be published. Required fields are marked *