Overview
A variable is a container for a piece of information. You can insert variables into automation steps to automatically populate data from Rippling or another data source you’re querying in your automation. Anywhere you see the variable icon, you can click and select a variable.
Think of a variable as having two parts: the container and the value.
- The variable itself is an empty container.
- The value stored in that container gets added by the automation when the step using the variable runs.
The values in variables can be updated dynamically, so they “vary” from one run of the automation to the next.
Variable types
There are three types of variables you can add to an automation:
- Variables from the trigger - Fields from the object you’re using to trigger the automation can be used as variables in downstream steps. For example, if you’re triggering an when a new hire is approved, you can add variables for fields in the Employee object. If you’re triggering an automation when a record is created on a custom object, you can add variables to pull in fields from that custom object. Variables from the trigger can be used in all downstream steps for the entire life of the automation.
- Variables from upstream steps - Fields containing the output of upstream steps can be used in later steps as variables.
- Custom variables - You can create your own custom variables. This is particularly handy when you need to complete a calculation to use in the automation and you don’t need to use it anywhere else in Rippling. You can save the calculation as an automation variable rather than saving it as a formula field.
Using old and new values from the trigger event
When your automation trigger is for an update to a record, both the old and new values are available as variables.
- The old value is what the value was before the update occurred.
- The new value is the value after the change, or in other words, the current value.
For example, say you create an automation that triggers whenever the annual compensation for a member of Marketing changes. The automation sends an email to the director of the department, and you want it to show what’s changed. You can include variables for both the old and new values for a side-by-side comparison.
Add a variable for the effective date or requester of the change
When your automation is triggered based on a change event, you can access details about the change event as variables. This includes:
- Requested date of the change
- Effective date of the change
- Who the change was requested by, and their attributes
You can find these variables by navigating to the Trigger > Event details.
Uses for custom variables
Here are a few common uses for custom variables:
- Transform the information returned by a previous step of the automation for use in a subsequent step. For example, if you have an automation step to call an API, you can extract information from the response and store it as a variable to be used in a later step.
- Store the result of a calculation and reuse it instead of calculating it every time.
- Assemble a collection of records that satisfy a condition. If you use a bulk operation to loop over all tasks and select the ones that satisfy a certain condition, you can store the resulting set in a variable so you can reuse it. Without a variable, you would have to loop again and re-filter every time you need the set.
- Keep a running tally of how many times a loop has run.
Example of a custom variable
When a sales opportunity is marked as closed/won, you want to trigger an automation that sends a Slack message to a team channel. In the message, you want to include the monthly running total of closed/won opportunities.
This example uses custom objects, but you could also create a custom variable using any of the native data in Rippling.
To do this, you’ll write a formula that uses data from the opportunity object to calculate the monthly running total and save it as a variable named Running total.
You can then include the Running total variable in the Slack message.
Default values for variables
Every time an automation runs, its variables start out containing their default value. If the default value is blank, the variable starts as blank. Variable values are never carried from one automation run to another.
You set custom variables up in two parts: create the variable (the container and type), then assign a value with the Assign value to a variable step.
To create the variable:
- Open the automation in Automation Studio and click the three dots in the top right corner > Manage my variables.
- Click +New variable.
- Name the variable and select a variable type so downstream steps can use it reliably (for example, a count must be an integer).
- Add an optional description > click Save.
Now that the variable is created, assign the variable a value:
- Click +Add a step > Assign value to a variable after any steps whose output you want to use.
- Click the step to assign a name and select the variable you created.
- In the formula editor, define the value. You can use RQL and include other automation variables.
- Click Save.
The assigned value is available to all downstream steps.
Some RQL functions are not available in automations. For more information, see Limits.