cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
hooorie
Nintex Newbie

run workflow with JavaScript in SharePoint edit form

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("loginSmiley Tongueass"));
},
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?

0 Kudos
Reply
4 Replies
Automation Master
Automation Master

Re: run workflow with JavaScript in SharePoint edit form

How about setting a field value when saving your specific form and have your workflow started conditionally when this field is updated with a specific value?

Reply
Automation Master
Automation Master

Re: run workflow with JavaScript in SharePoint edit form

Hello,

You can also use a start condition on your workflow to start the workflow automatically on item modify.   

Thanks

Mike

0 Kudos
Reply
hooorie
Nintex Newbie

Re: run workflow with JavaScript in SharePoint edit form

I know this way! I want do that with JavaScript code in specific edit form.

0 Kudos
Reply
hooorie
Nintex Newbie

Re: run workflow with JavaScript in SharePoint edit form

thanks a lot, i do not want add field, I need call web service and start workflow directly.

0 Kudos
Reply