I have a requirement where the Master user has power to interrupt any workflow and put it on hold and the approvals should be stopped on that workflow until the Master user resumes the workflow.

When creating a CSOM project and writing code in C#, I could find methods http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.workflowservices.workflowinstanceservice.suspendworkflow(v=office.15).aspx

As WorkflowInstanceService.SuspendWorkflow and WorkflowInstanceService.ResumeWorkflow. However I need to use these methods with CSOM - EcmaScript.

I am able to terminateWorkflow using JavaScript. However for Suspend and Resume it doesn't work.

Anyone having success in SuspendWorkflow and ResumeWorkflow using JavaScript object model?

1 Answer 1


Yes, you can do it from JS. The code will be something like this:

(function () {

    var workflowInstanceId = 'PUT-YOUR-GUID-HERE';

    var context = SP.ClientContext.get_current();
    var web = context.get_web();

    var servicesManager = SP.WorkflowServices.WorkflowServicesManager.newObject(context, web);

    var instance = servicesManager.getWorkflowInstanceService().getInstance(workflowInstanceId);

    // or servicesManager.getWorkflowInstanceService().resumeInstance(instance);

    context.executeQueryAsync(function (sender, args) {

        alert('Instance was suspended successfully!');

    function (sender, args) {
        alert("Error occured! " + args.get_message() + 
                 '\r\nStack trace: ' + args.get_stackTrace());


If you don't know the workflow instance ID, you can enumerate all the instances e.g. for a list item, using method enumerateInstancesForListItem(listId, itemId) of the WorkflowInstanceService.

Also you can determine if the workflow is suspended or is running at the moment by getting the instance (don't forget context.load(instance), and then inside executeQueryAsync success callback you can use it) and then analysing the get_status() property of the instance. Possible status values are stored in the SP.WorkflowServices.WorkflowStatus enumeration.

Useful resources:

  1. Using SharePoint Workflow Services JS API (from CodeProject)
  2. Annotated definition for WorkflowServices.js SharePoint file

Disclaimer: both the article and the definition were authored by me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.