Unauthorized attempt to update workflow task by user nintex.dll

  • 18 July 2018
  • 1 reply
  • 8 views

Badge

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:

217106_pastedImage_1.png

Code only executes when i try to complete it with System Account. Any help would be really appreciated.


1 reply

Badge +17

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.

Reply