Lesson 1
2. Workflow activities and workflow context
Workflow activities are the individual steps or tasks that make up a workflow, while the workflow context is the runtime environment that manages the execution of those activities. Essentially, activities are the building blocks, and the context is the process that orchestrates them.
Workflow Activities:
-
Definition:Activities are the discrete actions or steps within a workflow, such as sending an email, updating a record, or waiting for approval.
-
Purpose:They perform specific tasks and contribute to the overall goal of the workflow.
-
Examples:In a ServiceNow workflow, activities might include sending notifications, assigning tasks, or creating records.
Workflow Context:
-
Definition:A workflow context is an instance of a workflow that is currently running. It represents the state of a workflow as it progresses through its activities.
-
Purpose:It manages the execution of activities, tracks their progress, and stores relevant information about the workflow’s state.
-
Key Features:
- Tracking: It keeps track of which activities have been completed, are currently executing, or are waiting to be executed.
- State Management: It maintains the overall state of the workflow, including its progress and any data associated with it.
- Relationship to Requests: In many systems, like ServiceNow, each workflow request (e.g., a catalog item submission) has its own workflow context.
- Example: If you submit a request twice, each submission will have its own workflow context, even if they are based on the same workflow definition.
- Tracking: It keeps track of which activities have been completed, are currently executing, or are waiting to be executed.
Relationship:
- A workflow is composed of activities, and the workflow context provides the environment in which those activities are executed.
- The context ensures that the activities are performed in the correct order and that the workflow progresses as intended.
- Think of it as a blueprint (workflow) and a running copy (workflow context) of that blueprint.