rizwan_akhter
Nintex Newbie

Update Nintex Workflow Task with Javascript

Hello,

I am trying to update my Nintex Workflow Task with Javascript but i am facing below error:

"Value does not fall within the expected range"

Below is my Javascript which is working fine for SP Designer Workflow Task but not working for Nintex Workfow Task.

function completeTask(id, action)
{
$.ajax({
url:_spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('Tasks')/items(2)",
type: "POST",
data: JSON.stringify({ '__metadata': { 'type': 'SP.Data.TasksListItem' }, 'Title': 'Updated' }),
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json; odata=verbose");
},
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*",
"content-type": "application/json;odata=verbose",
"X-HTTP-Method": "MERGE"
},
success: function (data) {
console.log('Item updated');
},
error: function (data) {
var errText = $.parseJSON(data.responseText);
alert(errText.error.message.value);
}
});
}

Is there any limitation or i am doing anything wrong? Any help in this regard will be really appriciated.

Thanks,

0 Kudos
Reply
1 Reply
eharris04
Workflow Hero

Re: Update Nintex Workflow Task with Javascript

Are you updating the workflow task list item that is linked to the workflow? I can't tell which list you are actually updating, but that would be the first thing to ensure you are doing. Also if you are using rest, you can update the item directly as a normal SharePoint list and the workflow will read that update (i.e. status = complete) and process it accordingly.

Why are you trying to use JavaScript? What is the outcome you want to achieve?

0 Kudos
Reply