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.