Orchestration
...
Native Actions
Using Variables in Playbooks
12 min
the variables feature in swimlane turbine allows orchestrators to collect, store, and use data across various actions within playbooks by leveraging the create variables and update variables native actions, orchestrators can define and modify variables without writing any code this enables greater flexibility and ease of use in complex workflows overview variables in swimlane turbine serve as temporary data storage that can be dynamically manipulated throughout the execution of a playbook this allows playbooks to make decisions, manage data, and pass information between actions seamlessly key benefits dynamic data handling easily collect, modify, and utilize data throughout the workflow code free configuration create and update variables without the need for scripting improved flexibility enable complex logic and decision making capabilities by dynamically adjusting the flow of actions seamless integration variables can be used across different actions, ensuring smooth data flow and continuity within playbooks promotable variables promote variables for accessibility across multiple playbooks, enhancing reusability and reducing redundancy creating variables the create variables native action enables orchestrators to generate new variables that can be applied across downstream actions here’s how to use it start by adding a trigger or existing playbook action to ensure upstream data is available for the variables from the add panel, drag and drop the create variables action onto the playbook canvas click configure , then select add variable a list of available property types will appear the following types are currently supported string, number, boolean, object, array, or attachment if you want to add more than one variable, click add variable again and select another property type in the variable box, enter a value directly or click select a property to open the property drawer the property drawer displays all available inputs from upstream playbooks, actions, or event inputs you can also select expression and use dot notation for advanced variable manipulation if you want the variable accessible outside of the current playbook, click +promote you can mark the data as sensitive while creating a variable click the ellipsis button next to the select a property and click mark sensitive now that the variable is created, you can reference it in subsequent actions in the next action's configuration, under inputs , click select a property to access the variable from the playbook property drawer congratulations! you now have a variable to use in your playbook workflow example creating an object variable here’s an example of creating an object variable to store a url drag and drop the create variables action add a new variable, select object as the type, and name it object test2 under object test2 , add a property named string akbds and set its value to $event data url promote the variable if you want to use it across multiple playbooks updating variables if you need to modify an existing variable, use the update variables action below is an example where a string and object variable are updated how to update variables add the update variables action to the playbook canvas, then click configure click select variable to update to open the playbook property drawer from here, select the variable you want to modify once selected, enter new data, choose a playbook property, or use an expression to update the variable the variable is now updated and can be used in subsequent actions example updating a string variable here’s an example of updating a string variable select the string variable string 1 set its new value to "good job" apply the changes and continue building your playbook advanced use cases handling arrays use arrays to store lists of values and iterate over them with loop actions create an array variable named email list add email addresses as elements within the array use a loop action to iterate through each email and perform actions like sending notifications or logging details error handling with variables use variables to capture and log error messages dynamically create a string variable named error message in your error handling action, set the variable to the error output using an expression or property selection log or display the variable in subsequent actions to track errors efficiently troubleshooting variable not updating ensure the variable is correctly referenced and updated in the action check for spelling errors or incorrect property paths unexpected variable values review upstream actions to ensure data is being passed correctly use logs or debugging actions to trace variable changes missing variables in property drawer confirm that variables are promoted if needed for accessibility in other playbooks best practices keep variables organized use descriptive names and add clear descriptions to your variables to make your playbooks easier to understand promote when necessary only promote variables that need to be accessible across multiple playbooks to avoid cluttering the global variable space test variable logic regularly test your playbooks to ensure variables are set and updated correctly use expressions wisely leverage expressions for complex variable logic, but keep them as simple as possible for maintainability