AnsweredAssumed Answered

Programatically completing tasks now needs new field to be supplied?

Question asked by keegan on Feb 24, 2015
Latest reply on Feb 13, 2017 by toby.lin

Part of a project we're working on requires the ability to programatically complete tasks in a 2010 environment. We wrote this functionality following the examples from the Nintex Workflow SDK and SharePoint to complete Flexi Tasks and supplying the relevant "Outcome" of the task programatically.

 

This functionality was working without issue for a period of time and later, without code change, the functionality stopped working. The behaviour was that the task was marked as completed in all of the usual fields (SP + Nintex) but the workflow had not proceed to the next action in the flow. The workflow had an error that the Outcome of the task (the option selected) was not selected or not saved. The actual error received was: Error in task. Value cannot be null

 

When comparing workflow task items before and after manually completing them via a Nintex Form I discovered that there was a field being set on the task that was not being set when completing the task programatically.

 

This field, ApproverTaskID, once set correctly would then allow the task to complete without issue and the workflow to continue as per usual. The code to get the value for this field and to set it is:

 

NintexTask task = NintexTask.RetrieveTask(spTask.ID, web, list);

Approver approver = task.Approvers.GetBySPId(spTask.ID);

spTask["ApproverTaskID"] = approver.ApproverID;

 

Making this change appears to have resolved the issue entirely with no other code changes. The problem we have is that the usage of this field is not documented anywhere by Nintex or by Microsoft and so we are seeking validation of this solution to this problem. Searching the field on Google returns approx 10 non-related results. Without this field being set the task does not complete and so this problem must be a problem for other people too.

 

Before pushing this change to production we want to verify that this field is a known issue / known requirement, but we are unable to confirm this.

 

Any information you can shed on this field would be great, thank you.

Outcomes