AnsweredAssumed Answered

Start Nintex Workflow with Button on site page using ECMA script

Question asked by kalyanpolasi on Sep 25, 2015
Latest reply on May 16, 2017 by cazza162

I able  to implement a successful solution using SharePoint Designer workflows. however, when I try to trigger the Nintex workflow by clicking on a button is failing with below error.

 

Error: Value cannot be null.

Parameter name: subscription undefined

 

Below is the code snippet I used with SPD workflow and the same I tried to trigger Nintex workflow:

 

var WorkflowInstanceID = "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx";

var web = clientContext.get_web();

var wfServiceManager = new SP.WorkflowServices.WorkflowServicesManager(clientContext, web);

var subscription = wfServiceManager.getWorkflowSubscriptionService().getSubscription(WorkflowInstanceID);

clientContext.load(subscription);

clientContext.executeQueryAsync(

function(sender, args)

{

var inputParameters = {};

wfServiceManager.getWorkflowInstanceService().startWorkflowOnListItem(subscription, itemId, inputParameters);

clientContext.executeQueryAsync(

function(sender, args)

{

alert("Email Sent");

},

function(sender, args)

{

alert("Email Failed to Sent \n Error: " + args.get_message() + "\n" + args.get_stackTrace());

}

);

},

function(sender,args)

{

alert("Email Failed to Sent \n Error: " + args.get_message() + "\n" + args.get_stackTrace());

});

 

Appreciate your quick response

Outcomes