1

I have a web resource in Microsoft Dynamics 2013 with an event in javascript where I would like to duplicate the same functionality of deactivating a workflow as the "Deactivate" button on the edit workflow page in CRM.

I'm using the XrmServiceToolkit, and I was hoping that I would be able to "SetSate" of the workflow with the Soap call provided within the toolkit. Like this...

XrmServiceToolkit.Soap.SetState(myWorflowNameHere, myWorflowIdHere, 1, 2);

Or even better ;)

XrmServiceToolkit.Rest.InactivateWorkflow(myWorkflowId);

There doesn't appear to be anything else available for what I'm trying to do.

My main goal of this exercise is to be able to edit a workflow from the javascript. To edit the workflow, it needs to be inactivated. I can get any data from the Workflow that I need to make this happen.

Any help regarding updating the ACTIVE workflow, or INACTIVATING the workflow from javascript is appreciated.

Rules:
It HAS to be done in the javascript of the web resource. Thanks in advance.

CodeBob
  • 775
  • 7
  • 14

1 Answers1

2

If you already have the id, you should be able to call

XrmServiceToolkit.Soap.SetState("workflow", workflowId, 0, 1); //StateCode: 0 = Draft, StatusCode: 1 = Draft
BlueSam
  • 1,888
  • 10
  • 17