From what I gather, the function has a line of code that does this comparison before attempting to complete the task. It's a sound security measure, but with no way to override. One solution is to write your own function without that step, but that's probably way too far out there. I don't think you can impersonate that user without creating a constant of the user or knowing the password of the user. I also assume that running the web service as a site collection admin would not get around this condition. That may be the only other test you could run.
It would be interesting that there is a way to reassign the task, then complete it, and not have a way to directly complete it as an admin. Could be something to add to suggested changes. But then again, it seems more of an official way of completing an action by first reassigning the task. I think in the form, when you are an admin you have to click the link to take over the task before you can complete it. So it is more of a feature, and a good security measure.
You can provide history to know what the original assignee was.
You would have to write your own Custom Action to work around the current user check. There is example code and instructions using the SDK Nintex Workflow 2010 SDK . But that is a big step to provide a work around.
Please see the below function ... Hope many will find this as a most helpfull one....
(Sharepoint 2013 , Infopath 2013 , Nintex Workflow 2013)
Public Function ProcessTaskResponse2(comments As String, outcome As String, spTaskId As Integer, taskListName As String) As ProcessTaskResponseResult
If spTaskId = 0 Then
Throw New ArgumentException("spTaskId is 0.")
Dim site As New SPSite(SPContext.Current.Web.Url)
Using web As SPWeb = site.OpenWeb()
web.AllowUnsafeUpdates = True
Dim lists As SPListCollection = web.Lists()
Dim sPList As SPList = Nothing
Dim outcome_ID As Integer
sPList = lists.Item(taskListName)
outcome_ID = ConfiguredOutcome.GetOutcomeId(outcome, web)
Dim sPListItem As SPListItem = NintexTask.RetrieveSPListItem(spTaskId, web, sPList)
Dim nintexTask__1 As NintexTask = NintexTask.RetrieveTask(spTaskId, web, sPList)
Dim bySPId As Approver = nintexTask__1.Approvers.GetBySPId(spTaskId)
Dim flag As Boolean = True
Dim taskLocker As New TaskLocker(bySPId)
flag = taskLocker.ObtainLock()
If Not flag Then
sPListItem.Item(NWSharePointObjects.FieldComments) = comments
sPListItem.Item(NWSharePointObjects.FieldDecision) = outcome_ID
Catch generatedExceptionName As Exception
If you are using infopath, Directly use it in the codebehind. If you want to use it in your workflow, create a new webservice with this code and call it....
thanks for your post
i faced same issue, but i am trying to use same function but there is an error in it like
please advice if you can help
You have to add Nintex workflow DLLs as references to the project
3.Microsoft.Sharepoint.DLL (Not sure required or not)