[id="understanding-workflow_{context}"]

[[_understanding_workflows_]]
=  Understanding workflows
[role="_abstract"]

A workflow is an activity or process within {project_name} that executes a series of predefined steps on a
specific realm resource in response to specific events and based on the defined conditions.

In {project_name}, there are two main types of events:

*   **User Events**: These events are initiated by users, such as login in or registering a new account.
*   **Admin Events**: These events are initiated by administrators through the Admin Console and API, such as creating or updating a user or any other realm resource.

Workflows are designed to respond to these events by automating tasks and processes that need to be performed and executed on the
realm resources associated with these events.

Once an event is fired, the workflow engine evaluates all defined workflows in the realm to determine if any should be
triggered based on the event type and the specified conditions. If the event matches the conditions defined in a workflow,
a workflow execution is created and assigned with an identifier. The workflow execution
is bound to the realm resource associated with the event, and only a single instance of a workflow can be active for that
realm resource at any given time.

A realm resource can be any entity within the realm, such as a user, client, group, or a role.
At the moment, workflows can be defined for the following realm resources:

*   Users

Once a workflow is active for a realm resource, its step chain is processed. The steps run sequentially, and they will
run immediately or be scheduled to execute later in time, depending on each step configuration.
Once all the steps are executed, the workflow execution is completed and the realm resource
is no longer bound to that workflow.

That is the main gist of {project_name} Workflows. There are more details and settings that can be
configured to customize the behavior and the lifecycle of a workflow, how their instances are created, managed,
and bound to realm resources, as well as how their steps are executed.
