Variables

What are variables?

Variables are an easy way of displaying ‘variable’ information that is unique to each of your workflow runs.

They effectively act as placeholders for information that you can push data into.

You can use them to cut down on data entry or copy-pasting information from one place to another, and use them to surface any information that might be required to complete a specific task.

Users: In order to create or edit workflows you must be an Administrator or a Full Member who has been given ‘edit’ access by your Administrator.

Variables examples

Here are some examples of how you can use variables:

  • To create a summary inside a task, so that data is collated in one place for easy review
  • To populate details in your email widget from form fields that were filled out in your workflow run
  • To add into workflow run links so that you can pre-fill data in new workflow runs
  • To pass data to or from other apps via automations

The example in the video below shows how to use variables in an annual leave request process.

Available Variables

Variable information could include the name of a workflow run, a workflow run created date, or data that was inputted into a form field in that specific workflow run.

There are global variables for almost every aspect of a workflow and workflow, namely:

  • Workflow Run creator (email) – {{run.created_by.email}}
  • Workflow Run creator (name) – {{run.created_by.name}}
  • Workflow Run created date – {{run.created_date}}
  • Workflow Run due date – {{run.due_date.full}}
  • Workflow Run name – {{run.name}}
  • Workflow Run URL – {{run.url}}
  • Current date – {{current_date.full}}
  • Current day of the month – {{current_date.day}}
  • Current month – {{current_date.month}}
  • Current user’s email – {{current_user.email}}
  • Current user’s name – {{current_user.name}}
  • Current year – {{current_date.year}}
  • Organization name – {{organization.name}}
  • Task due date – {{task.due_date.full}}
  • Task name – {{task.name}}
  • Task URL – {{task.url}}
  • Workflow name – {{workflow.name}}
  • Workflow URL – {{workflow.url}}

Most form fields that you create can also be used as variables, so the more you add the more you can use.

How to set up variables

First, locate the workflow you want to add variables to in your library and click the three dots next to the workflow’s name (or click its name).

This opens the workflow menu on the right-hand side of your screen. Next, click “Edit” to open the editor.

Setting up variables in a text widget

Select the task you want to use and drag and drop a text widget into the center of your screen.

In the example below, we’re creating a summary from data in other parts of our workflow.

Click the magic wand icon in the top right of the widget and then select the variable/s you want to use from the list that appears.

You can use any variable in text widgets, so if you have a lot in your list, type the name of your form field into the search box to narrow down your options.

Save changes to your workflow when you’re finished editing, and run your workflow to test everything is working as expected.

Pro tip: You can copy the variable (including the curly brackets) and use it elsewhere, such as into the body of an email widget or another text widget. For example: {{form.Employee_Email}} or {{form.Date_of_Birth}}

Setting up variables in an email widget

Select the task you want to use the variable in, and drag and drop an email widget into the center of your screen.

In the example below, we’re using a variety of variables to fill out details in an email widget.

Much like in text widgets, you can click the magic wand next to the fields in an email widget, to push information (a variable) into it from elsewhere in the workflow run.

However, when putting a variable into the “To”, “Cc”, or “Bcc” fields on an email widget your options will be limited to pushing in information from:

  • Email address form fields
  • Single line form fields (short text)
  • The current user’s email address (as in, the person using the workflow run)

Save changes to your workflow when you’re finished editing, and run the workflow to test everything is working as expected.

Advanced variable options

Default values
Variables can have a default value set if there is no input into the form field, all you need to do is copy and paste this to the end of the existing variable text before the last two brackets (don’t forget the leading space at the beginning):

 |default:'there'

To set a default value for a variable, follow the below format:

{{form.First_Name|default:'there'}}

To set a blank default value for a variable, follow this format:

{{form.First_Name|default:''}}

Note that when using inverted commas, you’ll need to use two separate ‘ ‘ instead of “.

URL encode
You can use a URL encode on a variable to make symbols safe to use in a link or Send Email widget. Simply copy and paste this to the end of the existing variable text before the last two brackets (don’t forget the leading space at the beginning):

 |url_encode

Your link containing a variable should look like this if followed properly:

http://google.com?q={{form.Name|url_encode}}

This will ensure your link will not break if your form fields have values with spaces or symbols inside such as “Name”, “Address”, or “Title”.

Spaces in variables
One final thing to note is ‘spaces’ have no effect on variables when not used in a link.

Example:
{{Hey}} is the same as {{ Hey }} and also {{Hey }}

Using variables

When running a workflow

To use a variable you need to run the workflow from a workflow where you’ve set them up. Click the three dots next to a workflow’s name in your library, and then click “Run” on the right-hand side of your screen.

Once the workflow run is open, fill out the form fields you are using as variables and then take a look at how the information is pulled through into your email or text widget.

When you create a workflow run link, you have the option to add variables into the link, so that you can pull data from one place (for example another workflow run or a CRM) into your new workflow run.

Learn more about workflow run links, and also how to use variables in integrations links.


 

Was this article helpful?

Related Articles