Nintex for SharePoint Forum
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results forÂ
Hi,
I am trying to complete a Flexi task with c# code. Below is my function:
private void CompleteFlexiTask(SPWeb web, SPList taskList, int actionId, int taskId)
{
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPListItem spTask = taskList.GetItemById((taskId));
Guid commentsFieldId = Nintex.Workflow.Common.NWSharePointObjects.FieldComments;
Guid decisionFieldId = Nintex.Workflow.Common.NWSharePointObjects.FieldDecision;
Guid outcome = Nintex.Workflow.Common.NWSharePointObjects.FieldApprovalOutcome;
spTask[decisionFieldId] = actionId;
spTask[commentsFieldId] = "Comments";
spTask[outcome] = 2;
web.AllowUnsafeUpdates = true;
spTask.Update();
web.AllowUnsafeUpdates = false;
}
);
}
catch (Exception ex) { }
}
I want to execute this code with a specific user other than System Account. But i am getting below error even i added this user as site owner and Farm Administrator:
Code only executes when i try to complete it with System Account. Any help would be really appreciated.
Solved! Go to Solution.
Updating workflow task outside of the task form, task list a d or Express approval (email) is not supported by Nintex.
An option if you must use code would be to update the task item in SharePoint and allowing that update to trigger Nintex and SharePoint to complete the task as it should.