AnsweredAssumed Answered

run workflow with JavaScript in SharePoint edit form

Question asked by hooorie on Mar 27, 2018
Latest reply on Mar 27, 2018 by hooorie

I have some different edit from so I want start workflow after save specific edit from.

I use below code and eventually i get "success" ! but workflow does not start on specific item.

 

function StartAttachment(ItemID, ListName, SiteURL, WFName) {
var sr = '<?xml version="1.0" encoding="utf-8"?>'
+' <soap:Body>'
+'<StartWorkflowOnListItem xmlns="http://nintex.com">'
+'<itemId>95</itemId>'
+'<listName>IssueTracker</listName>'
+'<workflowName>Attachment WF</workflowName>'
+'<associationData></associationData>'
+'</StartWorkflowOnListItem>'
+'</soap:Body>'
+'</soap:Envelope>'
$.ajax({
url: SiteURL + "/_vti_bin/NintexWorkflow/Workflow.asmx",
beforeSend: function (xhr) {
xhr.setRequestHeader("SOAPAction", "http://nintex.com/StartWorkflowOnListItem");
//POINT[1]
//xhr.setRequestHeader ("Authorization", "Basic " + window.btoa("login:pass"));
},
type: "POST",
dataType: "xml",
data: sr,
success: function () {
alert("success");
},
contentType: "text/xml; charset=utf-8",
error: function (requestObject, error, errorThrown) {
alert(requestObject.status + " " + error + " " + errorThrown); }
});
}

how can I do that?

Outcomes