I am using Request Data task in a Nintex 2016 workflow in SharePoint 2016 on-premise.
I have attached custom content type to it and also added one custom outcome field called MOutcome.
I am using custom form which is displayed when a user clicks on task title in Workflow tasks list. I achieved it by creating a feature where I am assigning my own custom application page based on content type.
My custom application page displays fine.
On that custom page I have one approve button clicking on which I set the default outcome to "Continue" and my custom outcome MOutcome to "Approve" but workflow doesn't move to next step. It just remains at Request Data step.
But if I use the default/OOB task form which shows "Complete Task" button in SharePoint then it moves workflow to next step even though I have seen it also performs the same operations i.e. setting default outcome to "Continue" and MOutcome to "Approve"
What code shall I write on my button in custom form so that this task is completed and workflow moves to next step? Or in other words how can I make Request Data task complete on a click of a button which is my custom code?
By the way my C# code on button click of approve button is something like this:
item["Outcome"] = "Continue"; //i know Outcome is not the internal name of that variable this is just example
item["MOutcome"] = "Approve";
Please respond if someone has an answer as I am stuck. I have to use Request Data because then I can assign a custom content type.
I was able to solve it by referencing Nintex.Workflow.HumanApproval library and writing following code:
SPListItem taskitem = NintexTask.RetrieveSPListItem(YourItemID, web, web.Lists[YourWorkflowTasksListName]);
taskitem[Nintex.Workflow.Common.NWSharePointObjects.FieldDecision] = 1;
taskitem[Nintex.Workflow.Common.NWSharePointObjects.FieldApprovalOutcome] = 1;
Oh and I am using Flexi Task.The number "1" above is the serial number of your outcome in Flexi Task. For e.g. if your task has three outcomes (reject, send back, approve) then number 1 will be assigned to first outcome i.e. reject