Como obter o aprovador correto
-
09-12-2019 - |
Pergunta
Criamos um fluxo de trabalho de aprovação personalizado.A tarefa de aprovação é atribuída ao usuário A. Mas às vezes o usuário B iria abrir a tarefa e aprová-lo.Como você pode ver pela captura de tela, diz quem foi atribuído (usuário a) e que realmente aprovou (usuário b).
Como podemos programaticamente (C #) obter as duas contas usadas para aprovação?
Solução
I presume you mean the AssignedTo and the ModifiedBy? Assigned to is the assigned user, and when you approve a task it gets put into Modified By.
You get them like:
SPListItem task = taskList.Items.GetItemById(taskID);
string modifiedby = task["Modified By"].ToString();
string assignedto = task["Assigned To"].ToString();
If you want to do something that stores just the Approver, then you will need an event handler or the akin on updating that sets a custom column if the approval has changed.
Outras dicas
I ended up using a local variable from the Approval task, which contains "Modified by". Then I added a property to my custom workflow action. The property was set by using the variable from the workflow.