Skip to main content

Automation Variables

Automation Variables store and share data in workflows, enabling conditional actions and dynamic, context-aware automations.

Updated over a month ago

Automation Variables add dynamic capabilities to your automations by allowing you to store, reference, and pass data across various actions. They enable adaptable workflows by integrating context-specific data, which can be used conditionally to control automation actions, creating more precise and flexible operations.

Key Features

  • Conditional Control: Automation Variables exist only within an automation and can determine whether future actions run or are skipped based on specific conditions.

  • Data Sharing Across Actions: Variables allow for data to be shared between different actions within the same automation, enhancing the cohesion of your automation flows.

  • Integration with Scripts: Variables can be mapped to script variables, allowing data to flow seamlessly between automations and scripts, creating adaptable and efficient workflows.

Creating Automation Variables

  1. From the Automation Menu:

    • Within an automation, select Variables from the top menu. Here, you’ll see all variables associated with this automation and can add new ones.

    • Provide a unique name for each variable (without spaces) and, if needed, a default value.

  2. From an Action Output:

    • Variables can also be created dynamically from any action’s output by selecting Additional options in the action setup.

    • Under Assign action output to variable, specify the name of the variable to store the output.

Using Automation Variables

  • Referencing Variables:

    • You can use Automation Variables wherever you see the variable icon. For example, in a Shell action, click the variable icon to access a list of available variables and custom fields.

    • Select a variable to dynamically insert its value into your action or script.

Mapping Script Variables to Automation Variables

Script-Variable Mapping

When using a script that has predefined variables, you can map these script variables to Automation Variables for seamless data integration.

First, you'll need to create the variables in the script to do this. Let's walk through how to do that. Click the edit button, and then in the script, click variables.


Click the create button on that page. You should be shown with a dialog like this:


Enter the name, and any default value as needed. Repeat this step for any other variables you might need. Once Complete, the mapping will show in the Run Script Action as seen below:

You can also assign values to automation variables directly from within your script to pass data back into the automation. Simply add something like:


{{ MyCoolVar = $MyCoolScriptVar }}


(just replace the names with the variables you’ve created). This will assign the script variable’s value to the automation variable and output it so you can use it in later steps of the automation.



Summary

Automation Variables enhance the flexibility and efficiency of your automations in Level by enabling data-driven decision-making within workflows. Whether setting conditions, sharing data between actions, or mapping to script variables, Automation Variables are essential for creating responsive, customized, and powerful automations.

Did this answer your question?