latest Post

Dynamics CRM 365 WEB API Execute Workflow

As CRM developers we often find ourselves creating on demand workflows so that our users can perform some action as and when they need to. Unfortunately the user experience to do this OOB is not great selecting the ellipses >> Clicking Run Workflow, >> Choosing the workflow and clicking ok.



A much better solution to this is to add a button to the form ribbon and write the code to trigger the workflow from the button click. In the past to do this I have written A SOAP command to trigger the workflow from within JavaScript and those of you who have written SOAP envelopes know how tricky they can be. 
Fortunately in Dynamics 365 the Web API platform has been extended to allow you to trigger a workflow by simply calling the "execute workflow" method.  This is a lot simpler than doing this with SOAP.

Below is an example of triggering the workflow

Get Workflow GUID
 In order to easily find the workflow Name to use in the above helper method I wrote the below method to return the workflow GUID when given the work flow name.
Smart Buttons Ribbon workbench editor
An alternative solution to using the trigger workflow WEB API method above would be to use the latest version of the Ribbon Workbench which now includes Smart Buttons to allow you to call a workflow directly from the button without needing to write custom code to do this.  https://www.develop1.net/public/post/Smart-Buttons-in-the-Ribbon-Workbench.aspx

* Execute Workflow helper function expanded on from the following blog post on http://www.inogic.com.
Recommended Posts × +

3 comments:

  1. Wow i can say that this is another great article as expected of this blog.Bookmarked this site.. trafficize reviews

    ReplyDelete
  2. Thanks for sharing the detail of the code as well. We all want to find the best solutions to the problems we face. When I used the best dissertation writing service uk I found some great ideas that are really useful.

    ReplyDelete
  3. I really want to thank Dr Emu for saving my marriage. My wife really treated me badly and left home for almost 3 month this got me sick and confused. Then I told my friend about how my wife has changed towards me. Then she told me to contact Dr Emu that he will help me bring back my wife and change her back to a good woman. I never believed in all this but I gave it a try. Dr Emu casted a spell of return of love on her, and my wife came back home for forgiveness and today we are happy again. If you are going through any relationship stress or you want back your Ex or Divorce husband you can contact his whatsapp +2347012841542 or email emutemple@gmail.com website: Https://emutemple.wordpress.com/ Https://web.facebook.com/Emu-Temple-104891335203341

    ReplyDelete