Come ottenere il corretto approvatore
-
09-12-2019 - |
Domanda
Abbiamo creato un flusso di lavoro di approvazione personalizzato.L'attività di approvazione è assegnata all'utente A. Ma a volte l'utente B avrebbe aperto l'attività e approvere.Come puoi vedere dallo screenshot, afferma chi è stato assegnato (User A) e chi è effettivamente approvato (Utente B).
Come possiamo programmare a livello di programmazione (c #) entrambi gli account utilizzati per l'approvazione?
Soluzione
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.
Altri suggerimenti
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.