Switch by Value
Definition
The Switch by Value action allows you to direct the flow of your automation based on the value of a specific input. By defining branches with specific values, you can determine which set of actions will be executed when the input matches one of those values. This action also includes a default branch to handle cases where no match is found. Key capabilities include:
- Dynamically routing workflows based on specific values.
- Supporting multiple branches for flexible decision-making.
- Case-sensitive or case-insensitive matching for precise control.
This action is ideal for creating workflows that adapt to different scenarios based on data or user inputs.
Example Use Cases
1. Routing Based on User Input
Use this action to process user responses in a form or survey. For example, if a user selects "Support" as their issue type, the flow can route the task to the support team.
3. Directing Approval Processes
In an approval workflow, use the action to route tasks based on the approver's decision (e.g., "Approved," "Rejected," or "Needs Revision").
4. Dynamic Email Templates
Select different email templates based on the recipient's role or preferences. For example, send a tailored email for "Customer," "Vendor," or "Employee."
5. Assigning Tasks Based on Region
Route tasks to regional managers based on the user's location or region code in the input data.
Inputs
1. Input
- Description: The value that will be evaluated to determine which branch of the workflow to execute.
- Example: If you want to route based on a user's role, the input might be a variable like
UserRole
.
2. Values
- Description: The specific values to match against the input. Each value corresponds to a branch in the workflow.
- Example: If the input is
UserRole
, values could be "Admin," "Editor," or "Viewer."
3. Add Branch
- Description: Allows you to add additional branches for different values. Each branch represents a possible route the workflow can take.
- Example: Add branches for "Admin Actions," "Editor Actions," and "Viewer Actions."
4. Default Branch
- Description: The fallback branch executed when the input does not match any of the specified values.
- Example: If none of the values match
UserRole
, the default branch might handle the case as "Unrecognized Role."
5. Case Sensitive Match
- Description: Determines whether the value matching should be case-sensitive. If enabled, "Admin" and "admin" would be treated as different values.
- Example: Enable this field if exact case matching is critical for your workflow logic.
These inputs provide the flexibility to adapt the workflow dynamically based on specific criteria.
Step-by-Step Guide
Step 1: Add the Action to Your Flow
Drag and drop the Switch by Value action into your flow at the point where you need to route the workflow based on a specific value.
Step 2: Configure the Input Field
Set the Input field to the variable or value you want to evaluate.
- Example: Use a variable like
UserRole
to determine the role of the user in the flow.
Step 3: Define Values and Add Branches
Click Add Branch to create branches for each possible value.
- Example: Add branches for "Admin," "Editor," and "Viewer" if your input is user roles.
Step 4: Configure Actions in Each Branch
Inside each branch, add the specific actions to be performed when the input matches the corresponding value.
- Example:
- In the "Admin" branch, add actions for administrative tasks.
- In the "Editor" branch, add actions for content editing.
- In the "Viewer" branch, add actions for viewing permissions.
Step 5: Set a Default Branch
Configure the Default Branch to handle cases where the input value does not match any of the defined branches.
- Example: Add a notification action in the default branch to alert that the role is unrecognized.
Step 6: Adjust Case Sensitivity (Optional)
If your matching logic requires case sensitivity, enable the Case Sensitive Match field.
- Example: Enable this if "Admin" and "admin" should lead to different branches.
Step 7: Test the Flow
Run your flow with different input values to ensure that the workflow follows the correct branch based on the input.
This guide helps you implement the action effectively and customize your workflow based on dynamic input values.
Updated 5 days ago