AnsweredAssumed Answered

How to approve and reject  WF  tasks from a page?

Question asked by eyalseg on Mar 24, 2018
Latest reply on Apr 16, 2018 by eharris04

Hi every one

For approve or reject tasks from board page I use this function:

 

 

function updateFlexiTaskProcess(TaskID, Outcome, Comment, color) {
    var SiteUrl = _spPageContextInfo.webAbsoluteUrl;
    var WS_Url = "/_vti_bin/nintexworkflow/workflow.asmx";
    var FullURL = SiteUrl + WS_Url;
    var CallStatus = "";
    //create soap envelope
    var soapMessage = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://nintex.com">\
                         <soap:Header>\
                         </soap:Header>\
                         <soap:Body>\
                             <m:ProcessFlexiTaskResponse2 xmlns="http://nintex.com">\
                             <m:comments>' + Comment + '</m:comments>\
                             <m:outcome>' + Outcome + '</m:outcome> \
                             <m:spTaskId>'+ TaskID + '</m:spTaskId> \
                             <m:taskListName>Workflow Tasks</m:taskListName>\
                            </m:ProcessFlexiTaskResponse2> \
                         </soap:Body> \
                        </soap:Envelope>'

 

    var AjaxDefered = $.ajax({
        url: FullURL,
        type: "Post",
        dataType: "xml",
        data: soapMessage,
        cache: false,
        contentType: "text/xml;charset=utf-8",
        success: function () {
            CallStatus = "Task has been processed successfully";
        ...
            //color the button and change text
            $('.' + className + ' a[id=' + TaskID + ']').parent().parent().css('color', color).text(text).prepend(icon);
            console.log(CallStatus);
        },
        error: function (data) {
            CallStatus = "failed" + data;
        }
    });
}

 

 

 

It goes always to success - but the task is not updated...

What could be the problem?

Outcomes