web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Debajit's Dynamics CRM Blog / Dynamics CRM 2016 – Using S...

Dynamics CRM 2016 – Using SetProcessRequest message to update your Business Process programmatically

Debajit Dutta Profile Picture Debajit Dutta 2,702

Exploring new stuffs in Dynamics CRM 2016 is great and if it is something technical and gives me an opportunity to write some code, it’s like icing on the cake for me.

CRM 2016 has introduced the new SetProcessRequest message which enables you to set the business process of a target entity. So let’s get into some action here.

I will demo this with the opportunity entity. The opportunity entity has a default process of “Opportunity Sales Process”. Below is the opportunity record loaded with the same business process.

image

 

So I created another business process flow for the opportunity entity called “Opportunity Business Process Flow” I will switch the business process of the record for the above record to this new process.

var service = GetService();

            SetProcessRequest req = new SetProcessRequest();
            req.Target = new EntityReference("opportunity",Guid.Parse("7059510E-59A3-E511-80E4-3863BB35AD90"));
            req.NewProcess = new EntityReference("process", Guid.Parse("AEC906DF-5C10-490D-8D0E-E5620FAAE614"));

            var resp = service.Execute(req);

 

So once we open the record again, the new process is loaded.

image

 

So what about the workflows or plugins registered on change of processid of your application? SetProcessRequest will fire the update message and any workflows registered on change of processid would trigger.

Happy exploring CRM 2016.



This was originally posted here.

Comments

*This post is locked for comments