Please find below an example of calling the Execute method to run a workflow on CRM 365 Cloud.
let Id = formContext.data.entity.getId().replace('{', '').replace('}', '');
let request =
{
entity: { id: workflowId, entityType: "workflow" },
EntityId: { guid: Id },
getMetadata: function () {
return {
boundParameter: "entity",
operationType: 0,
//operation name is always “Execute Workflow” independent of workflow name
operationName: "ExecuteWorkflow", parameterTypes: {
"entity": {
"typeName": "mscrm.workflow",
"structuralProperty": 5
},
"EntityId": {
"typeName": "Edm.Guid",
"structuralProperty": 1
}
}
}
}
};
debugger;
Xrm.WebApi.online.execute(request).then(
function (result: any) {
debugger;
},
function (error: any) {
debugger;
});
Anything, please contact us on info@dynamicsmonster.com
Comments