top of page

Execute Workflow Request on CRM 365 Cloud

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

13 views0 comments

Recent Posts

See All

CRM 365 - Customer field only show Accounts

On a customer field, if the requirement is to only show Accounts, please add this line to the OnLoad of the form: //Show only Account records when selecting the Customer formContext.getControl("cu

Comments


bottom of page