Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Programmatically Update Nintex Task

$
0
0

Hi,

I am using Nintex Workflows 2013. 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]=outcomeit 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 !


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>