Execute WorkFlow using Xrm.WebApi in Dynamics CRM Version 9.0
A very interesting read from my colleague
It has been a long time that I have contributed to the blog posts :(. Well I have started again to tell some interesting things. Recently I started working on Xrm.WebApi CRUD operations wherein I have a requirement to send email when invoking a custom ribbon button.
So to implement the same I have created an on demand workflow on account entity as shown here

Now I tried to invoke my workflow from the custom ribbon button using
Xrm.WebApi.execute(request).then(successCallback, errorCallback);
Prepare request object similar to this to execute your workflow as shown below
var request = {};
//pass workflow Id and entityType as worflow
request.entity = { id: “cd78cbcc-080a-4a48-8b9d-46555b655c02”, entityType: “workflow” };
//pass record Id of type Guid ,here my workflow is on “Account” entity
request.EntityId = { guid: “A16B3F4B-1BE7-E611-8101-E0071B6AF231” };
request.getMetadata = function () {
return {
boundParameter: “entity”, /
operationType: 0,
//operation name is always “Execute Workflow” independent of…
View original post 115 more words
This was originally posted here.

Like
Report
*This post is locked for comments