Execute WorkFlow using Xrm.WebApi in Dynamics CRM Version 9.0

A very interesting read from my colleague

Chandana's CRM Blog

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s