Skip to content

Enhanced Variable Conditions in Playbooks #498

@sourabhbhandari

Description

@sourabhbhandari

Summary:
Currently, we can set conditions on previously executed steps to determine which path to follow in a playbook. However, this capability is limited and does not fully support complex decision-making based on diverse data inputs.

Current Limitation:
Playbooks have restricted support for conditional logic based on previous output values, mainly limited to timeseries, log data, or basic string matches. This limitation prevents the creation of dynamic playbooks that can adapt to real-time data or more intricate conditions.

Proposed Solution:

1. Conditions on Global Variables:

When creating a playbook and adding a step with conditions, allow users to create conditions based on global variable names.

For example, if an API call is made to retrieve a response, users should be able to filter the response, extract global variables, and define conditions based on those variables.

2. Introduction of Python Interpreter:

Provide a Python interface to check conditions and make decisions dynamically.

Enable execution of custom scripts to process previous step outputs and determine the next step in the workflow.

3. Conditional Operators:

Support for a broader range of operators such as:

Comparison: ==, !=, >, <, >=, <=

Logical: AND, OR, NOT

String operations: contains, startsWith, endsWith

4. Multiple Condition Handling:

Allow combining multiple conditions using logical operators.

Support for nested conditions to enable more complex logic.

5. Dynamic Variable Evaluation:

Support for evaluating variables at runtime instead of using static pre-conditions.

Selection of global variables from a dropdown menu for condition evaluation.

6. Default and Fallback Handling:

Allow setting default values in case a variable is missing or undefined.

7. UI/UX Improvements:

Provide an intuitive condition builder in the UI for users.

Enable syntax highlighting and validation for condition expressions.

Use Cases:

  • Custom automation paths based on output of previous step.
  • Error handling and fallback mechanisms for failed conditions.
  • Advanced decision-making using Python scripts.
  • Dynamic responses based on API call outputs and filtered global variables.

Expected Benefits:

  • Increased flexibility in playbook automation.
  • Reduction in the need for complex scripting workarounds.
  • Enhanced adaptability for real-time data processing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions