Find users who completed previous user tasks in a workflow
In my workflow I have a script task that follows a user task. The user task is assigned to a group of candidate users. However, in the script task, I would like to identify which user from the group actually completed the user task. How can I do this? Using users.current and userAPI.getCurrentUser() just returned a user named 'Workflow'.
donaldrau
Posted 2 years ago · Edited 1 year ago·Last reply 1 year ago
1 comment
whithedelcarre
·1 year agoIf a Timer Intermediate Event is placed between the User Task and the Script Task, any subsequent actions in the workflow will be executed as if the "workflow user" is performing them. Consequently, when using userAPI.getCurrentUser(), it will return a user named 'Workflow.'
To avoid this, ensure there is no intermediary task between the User Task and the Script Task. By doing so, userAPI.getCurrentUser() will correctly return the actual user who completed the task.
After obtaining the user information, store it in execution.setVariable to retain the data for use in subsequent tasks within the workflow.