Hi,
I am facing a strange problem, I am trying to programmatically close a flexi task, below is the code that is called on my custom task form on submit:
private void SubmitTask(int outCome, string historyComment)
{
using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb web = site.OpenWeb())
{
NintexTask approvalTask = (NintexTask)NintexTask.RetrieveTask(this.TaskID, web, web.Lists[this.TaskListGuid]);
Approver approver = approvalTask.Approvers.GetBySPId(this.TaskID);
SPWorkflow workflow = approvalTask.WFContext.WorkflowInstance;
if (approver != null && approvalTask.ApprovalStatus == Outcome.Pending &&
User.CheckCurrentUserMatchesHWUser(web, approver))
{
if (LockTask(approver, workflow))
{
SPListItem item = NintexTask.RetrieveSPListItem(this.TaskID, web, web.Lists[this.TaskListGuid]);
item[Nintex.Workflow.Common.NWSharePointObjects.FieldDecision] = outCome; // here it gives error
item[Nintex.Workflow.Common.NWSharePointObjects.FieldComments] = historyComment; // here it gives error
try
{
item.Update();
}
catch { approver.UpdateTaskLocked(false); throw; }
}
}
}
}
}
At item[Nintex.Workflow.Common.NWSharePointObjects.FieldDecision]=outcome it gives error that invalid field name in Tasks list. I am quite sure that there is no issue with the code as it is working for other workflows. I am stuck on this issue :( and don't know where is the problem ? .
Thanks in advance !