> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/workflows/designing-workflows/processes/process-execution/beans/users-bean.md).

# Users bean

* Available through the **users** variable
* Contains important functions for everything that is user related. For example:
  * `${users.current}` retrieves the current user name.
  * `${users.getUserNamesWithError(stakeholderUserExpression)}` evaluates the given user expression and lists the usernames.

## User impersonation

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

* `runAsUserById(UUID userId, Runnable runnable)`: Perform the runnable action as a the user with the provided ID.
* `runAsUserByUserName(String userName, Runnable runnable)`: Perform the runnable action as a the user with the provided username.

By default, synchronous script tasks are attributed to the user who starts the task, while [asynchronous script tasks](/workflows/designing-workflows/processes/process-execution.md#asynchronous-activities) are attributed to the [workflow user](/workflows/designing-workflows/processes/process-execution/the-workflow-user.md). Your workflow can also perform actions as a specific user, for example:

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

{% hint style="info" %}
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.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.collibra.com/workflows/designing-workflows/processes/process-execution/beans/users-bean.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
