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 GUIDIn 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.
Wow i can say that this is another great article as expected of this blog.Bookmarked this site.. trafficize reviews
ReplyDelete