Reputation: 832
I am working on a process that requires that an email be sent to all users who completed a task during a process.
My original plan was to add some code into the afterNodeLeft method of my implementation of the ProcessEventListener; however, it seems that the ProcessNodeLeftEvent interface does not have a method for looking up the executing user.
After hitting that dead end, I decided to look at the database tables to what was recorded for history. It appears that the NODEINSTANCELOG tables does not keep track of the user.
As a last ditch attempt, I figured that I could add an output parameter to every user task so that I could add the userid into the results Map. This appears to work, but it feels very kludgey.
Is there some audit service that I could use to look up this information or am I forced to update every user task to track which user completed each task.
Upvotes: 2
Views: 566
Reputation: 2918
A human task has an output parameter "ActorId" which you can map to a process variable for usage. You could also access it (in on-exit scripts or listeners) when you have access to the nodeInstance using:
((HumanTaskNodeInstance) nodeInstance).getWorkItem().getResult("ActorId")
Upvotes: 4
Reputation: 4153
yes you can use the task audit mechanism to hook up there the email notifications and keep them completely decoupled from your processes. Look for the TaskEventListener interface. HTH
Upvotes: 2