Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

How to approve and reject WF tasks from a page?

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="" xmlns:soap="" xmlns:m="">\
                             <mSmiley TonguerocessFlexiTaskResponse2 xmlns="">\
                             <m:comments>' + Comment + '</m:comments>\
                             <mSmiley Surprisedutcome>' + Outcome + '</mSmiley Surprisedutcome> \
                             <m:spTaskId>'+ TaskID + '</m:spTaskId> \
                             <m:taskListName>Workflow Tasks</m:taskListName>\
                            </mSmiley TonguerocessFlexiTaskResponse2> \
                         </soap:Body> \


    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);
        error: function (data) {
            CallStatus = "failed" + data;

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

What could be the problem?

0 Kudos
1 Reply
Community Manager Community Manager
Community Manager

Re: How to approve and reject WF tasks from a page?

Is there a reason you're using a function versus using the standard task form?

As for the default value, see if you can set the default outcome in the workflow to reject first, and see if that changes your success outcome. 

Accept as Solution Reply