Set Variable (Activity)
- Purpose: To create or modify workflow variables and assign values to them during workflow execution.
- Functionality: The "Set Variable" activity allows you to:
- Define Workflow Variables: Create new variables within the workflow's scope.
- Assign Values to Variables: Set or update the values of existing workflow variables. The values can be:
- Static Values: Fixed values defined directly in the activity configuration.
- Dynamic Values: Values derived from workflow data, previous activity outputs, expressions, or user input.
- Variable Data Types: Potentially specify the data type of the variable (e.g., string, integer, boolean, object, etc.).
- Use Cases:
- Data Storage and Manipulation: Storing intermediate data, calculation results, or configuration values in workflow variables for use in subsequent activities.
- Workflow State Management: Using variables to track the state of a workflow execution and make decisions based on variable values.
- Parameter Passing within Workflows: Using variables to pass data between different activities in a workflow.
- Dynamic Data Assignment: Assigning values to variables based on runtime conditions or data processing within the workflow.
How to Use Primitives Activities:
1. Drag and drop a Primitives activity from the Primitives section onto your workflow canvas.
2.Configure the properties of the chosen activity:
- For Correlate: Define correlation keys and sets as needed for your asynchronous or message-based workflow scenario.
- For Event: Specify the event type to listen for and configure event handling logic.
- For Fault: Configure error details or messages to be associated with the fault.
- For For, For Each, While, Parallel For Each: (These are actually in the "Looping" section, not "Primitives", based on previous context, but if listed under "Primitives" in your editor, configure them as looping structures).
- For Publish Event: Define the event type and payload data to be published.
- For Run Task: Specify the task to be executed, input parameters, and result handling.
- For Set Name: Enter a descriptive name for the target activity.
- For Set Variable: Define the variable name and the value to be assigned.
3. Connect the Primitives activities within your workflow to implement core workflow logic, control flow, handle events, manage data, and perform basic tasks.
4. Save and activate your workflow. When executed, the Primitives activities will perform their respective core workflow functions as configured.
Benefits of Using Primitives Section:
- Fundamental Workflow Building Blocks: Provides the essential activities for constructing any workflow, offering core functionalities for control flow, data manipulation, and event handling.
- Low-Level Control: Offers fine-grained control over workflow execution, allowing for precise management of workflow logic and behavior.
- Extensibility and Customization: Activities like "Run Task" provide extensibility points for integrating custom code or external processes into workflows.
- Foundation for Complex Workflows: Primitives form the basis for building more complex and specialized workflow activities and patterns.
- Workflow Core Functionality: Encompasses core workflow engine functionalities related to event handling, state management, error handling, and data manipulation.
By utilizing the Primitives section activities, you gain access to the fundamental building blocks for creating workflows in ELSA, enabling you to design processes with precise control over execution flow, data handling, and event-driven logic. These activities are essential for constructing both simple and complex automated processes.