Workflow Variables

Overview 

Workflow Variables functionality in Arigato Automation allows users to create workflows with special custom settings defined. These settings are specific form fields that are created once and then the value for the field can be changed or reused over and over.

Workflow Variables allow the creator of the workflow to collect or change a specific custom setting without changing the configuration of the workflow. For example, a workflow that sends an email might have a Workflow Variable to change the coupon code within the email.

Note, Arigato Automation also allows for custom coding, and standard code variables can be used throughout the app. Coding in the app does not require users to define each variable using this system however, Workflow Variables are available to use in any coding situation. More information on this topic is included below.

To get started, visit the Variables tab on any workflow, or in the sidebar hover on Storage then click on Global Variables.

Workflow Variables
Ideal for any settings or code that could be reused in more than one place in a single workflow.  Workflow Variables can also be exposed to users during Bulk Operations, allowing the user to enter data "on the fly" or override existing settings. These concepts can also be applied to Schedules and On-Demand workflows.

Global Variables
Ideal for any settings or code that could be reused across multiple workflows. Global Variables cannot be exposed to users during Bulk Operations, Schedules or On-Demand. 

Pro Tip: Global Variables include a limited selection of Tokens that will work in all situations and all workflow types. More specific tokens will work, but only if they are used in the correct context. For example, Product tokens will work if used in Global Variables if the Global Variable is called from a Product workflow, but they would not work as expected if called from an Order workflow.    

Variable Types

Text
A basic single line text field.
This field accepts text as well as Tokens and custom Twig code.
Text (Multiple-Lines)
A text area that expands to fit larger amounts of content. The default number of rows on the form is configurable.
This field accepts text as well as Tokens and custom Twig code.
Rows setting
The initial number of rows shown during content input. The field will expand to the size of the content entered regardless of this setting. 
Dropdown
A select list. Options can be formatted as simple values or as key/value pairs.
Options setting
Either plain options separated by new lines, or key/value pairs with keys and values separated by a | character and new lines to separate each key/value pair. 
Radios
A set of radio buttons. Options can be formatted as simple values or as key/value pairs. Options can be presented on the form horizontally or vertically.

Options setting
Either plain options separated by new lines, or key/value pairs with keys and values separated by a | character and new lines to separate each key/value pair.

Number
A whole number or a decimal. Increments can be set such as "10", allowing for increments of 10 e.g. 10, 20, 30.
Checkboxes
One more more checkboxes. Options can be formatted as simple values or as key/value pairs. Options can be presented on the form horizontally or vertically.

Options setting
Either plain options separated by new lines, or key/value pairs with keys and values separated by a | character and new lines to separate each key/value pair.
Date
A date field with several date format options for storage. The input field includes a modern date picker widget.
JSON
A text field formatted and stored as JSON. 
This field accepts text as well as Tokens and custom Twig code. 
Key/Value
A custom field that collects simple key/value pairs. This field is perfect for managing groups of data such as vendors and their email addresses.
This field does not accept Tokens or custom Twig code.

Common Settings for all Variable Types

Field Label

The label that will be used to refer to the field wherever it is displayed.

Machine Name
The internal identifier for the field. Machine names within a workflow must be unique. This value cannot be changed once the field is created. 

Token
A preview of the token syntax. All custom variables are also fully documented within the Token Browser for quick reference.

Enable for On Demand, Bulk Operations & Schedules
Reveals the field when setting up and running any of the above operations. Hidden fields are still available when a workflow runs, they are simply not shown to the user during the above operations.

Input Instructions
Helpful information shown whenever the field is displayed for editing.

Token Description
Helpful information shown within the Token Browser to describe the field.

Saving Values for Workflow Variables

Once a Variable has been created on the Variables tab, content (or code) can be entered on the Workflow page itself under the Variables section.

Variables and the Token Browser

Each defined variable is available in the Token Browser in a special group at the top level of the token browser under "Variables". Certain data points about a Variable are available in the Token Browser, see below.

Value
Contains the actual value of the Variable. 

Label
Displays the label that was entered for the Variable on the Variable's settings page.

Render Variable
A helper function to render a complete Variable in various formats such as Trello, Slack, HTML and markdown

Previewing Variables

Live preview is not available for Variables. Variables can be previewed like any other Token or code within an Action though. 

To render a preview of a Variable, add a "Log a message" Action to the workflow, then select the Variable from within the Token Browser to view the content of the Variable. Be sure to select an item to test with and ensure that the Variable has content to display.

Working with Variables in Code

Code documentation for Variables can be found on the Code Reference tab in the app, under the Variables section.

Using Variables in Actions

All Variables are available for use in Actions anywhere that accepts Tokens. They can be used just like any other Token and can be manipulated using Twig code.

Using Variables in Conditions

Variables are not defined as individual Conditions. Variables can only be used in Custom Conditions. To use a Variable in a Custom Condition, add a Custom Condition to the workflow, then in the Token Browser, locate the Variable to use as a Custom Condition. Finally, add the token to the Custom Twig Code area for the condition and edit it to become a simple "if" statement. For example:

{% if workflow_vars["radio"].value == 'my_value' %}
TRUE
{% endif %}

Using Workflow Variables in Bulk Operations, Schedules & On-Demand

Workflow Variables can be either exposed or hidden for use in Bulk Operations, Schedules and On-Demand Workflows, depending on your needs. See   Enable for On Demand, Bulk Operations & Schedules above for setup information.

Hidden & Exposed Variables

When Variables are hidden, they simply do not appear when creating a Bulk Operation or Schedule or running an On-Demand workflow. The values are still available for use within the Workflow itself. Hidden Variables are ideal for configuration settings or custom code snippets that would otherwise be maintained in several locations in a Workflow. 

When Variables are exposed, they add a configuration screen to the Bulk Operation, Schedule or On-Demand setup process. Exposed Variables are ideal for situations where a dynamic variable is needed. For example, a Variable might be set up for a coupon code and the corresponding Workflow might email that coupon code to the customer. Running an On-Demand Workflow would then allow an administrator to simply enter the coupon code to use at the time the Workflow executes. 

Behavior Rules for Variables

  • If a Variable does not have a value set on the Workflow itself, the input form for that Variable will automatically be displayed during Bulk Operation or Schedule setup.
  • If a Variable has a value set on the Workflow itself, that value will be displayed as text during Bulk Operation or Schedule setup, with the option to override the variable.
  • If a Variable is overridden in a Schedule, the Schedule will always use that overridden value, until the field is set to "Use Default" on the Schedule.
  • If a Variable's default value changes, the new value will be used in Bulk Operations or existing Schedules if the Variable is not overridden.

Sharing Workflows with Variables

Variables are sharable. When a Workflow with Variables is shared to the public library, the Variable's configuration is always included in the shared Workflow. Default values and other field data is not included by default, but can be included when the workflow is shared. 

For example, a Workflow might have a text Variable defined for an API key. Sharing the workflow will include the field for the API key, but not the key you entered into your version of the workflow. Another Workflow might have a dropdown of Days of the Week defined and the dropdown's options should be included in the shared workflow. In that case, a checkbox appears allowing the options and the default value to be shared.

Sharing of Global Variables is not supported.

Exporting and Importing Workflows with Variables

Workflows with Variables are fully importable and exportable. Exports will include the complete configuration of any defined Variable as well as any data values that have been set on the Workflow itself.

Variables in Workflow Revisions in Canvas Workflows

Variable values are Revisioned with any other changes to a Workflow. When a Workflow has a Revision and a Live, running Workflow, the Live Workflow's Variable values will be used when the Workflow runs. When testing/previewing the workflow in the editor, the current values in the Revision are used.

When running batches or On Demand workflows, the same rules apply. If a value is overridden manually during the batch setup, then the overridden value will be used. Otherwise, the value in the live workflow will be used.