Users bean

User impersonation

The Users bean provides two methods that allow your workflow to perform actions as a specific user:

By default, synchronous script tasks are attributed to the user who starts the task, while asynchronous script tasks are attributed to the workflow user. Your workflow can also perform actions as a specific user, for example:

users.runAsUserById(string2Uuid("01977cfd-f1e7-72c9-ae79-d7ff022c5502"), {commentApi.addComment(addCommentRequest)})

Note While actions performed by the workflow user are not subject to permission requirements, ensure that the user your workflow impersonates has roles with permissions to complete the assigned actions. Alternatively, implement a robust mechanism to handle permission-related errors.