Reference data in the workflow

Data is stored in several locations throughout your workflow. You can reference those locations to use the data in other steps.

Who can use this?

Plans:

  • Bridge by Smartsheet

Reference data from the runtime

The runtime is where trigger data from an integration is stored. The reference for runtime data is {{runtime}}.

You can reference individual data points stored within the runtime. When referencing these items, specify the name of each item.

For example, if a sheet in Smartsheet triggers a workflow and you need to reference the ID of the row involved, the reference is: {{runtime.event.rowId}}.

The exact structure and naming convention differ depending on the trigger and event type. 

To make sure use the correct reference:

  1. In the Run Log, hover over a trigger object. 
  2. Select the three-dot menu  Data Shuttle kebab menu .
  3. In the list that appears, select Copy Data Reference.
Brandfolder Image
Reference data

Reference data from a state

You can reference a state when data is passed from a parent workflow. The reference format is {{states.state name.value}}.

If you want to reference data from a module below a state, the state still plays a part. In this case, the reference structure is {{states.state name.integration or utility name.module name}}.

If a module can output multiple data values, add the path for the specific data in your data reference (similar to how you reference individual pieces of runtime data).

For example, the Smartsheet: Get Row module defaults to returning the data in the image below. 

Brandfolder Image
Reference data

To reference the value entered in the Address cell on the row, the reference is:
{{states.GetRow.smartsheet.get_row.row.cells.Address.value}}.

Reference data from a parent workflow

You can reference data from a parent workflow within a child workflow. 

  1. Copy the data reference you want to use from the parent workflow.
  2. Add a Run Child Workflow module within the parent workflow and name it.

In the parent workflow, in the child module:

  1. Select Child entity values. 
  2. Add a key (the name to reference the data in the child workflow).
  3. Add the corresponding value, the data reference you copied in step 1. For example, {{states.startstate.stringtools.compose_text}}

In the child workflow:

  1. Select the module where you want to reference the parent workflow data.
  2. In the field where you want to reference the parent workflow data, enter {{runtime.entities.text}}, where “text” is the key you added in step 4. 

If you want to reference {{runtime.entities.text}} like {{states.text.value}} within the child workflow, you must create a state named “text” in the child workflow.

Reference data from a child workflow

You can reference data from a child workflow within the parent workflow. Your data reference follows one of these patterns:

  • states.{{state that runs the child}}.child.{{state in child}}.value
  • states.{{state that runs the child}}.child.{{state in child}}.integration or utility.module

Handle empty data references

When the next step of your workflow depends on a specific value, which may or may not exist, you can use vertical bars (||) to handle both scenarios.

For example, you want to use the value in a Smartsheet cell to determine which path in a junction the workflow takes. But you can't be sure the cell always contains a value. 

If the cell is empty, the workflow stops when it reaches the junction. To avoid this, add vertical bars (||) at the end of your data reference. If that value has data, the workflow uses the reference to the left of the bars. If the value is empty, the workflow uses what's on the right of the bars.

Here's an example:
{{states.GetRow.smartsheet.get_row.row.cells.Address.value||116 George Street, Edinburgh, UK}}

  1. The workflow first tries to use the address from the row it retrieved earlier: GetRow.smartsheet.get_row.row.cells.Address.value.
  2. If that cell is blank, it uses the address specified after the vertical bars: 116 George Street, Edinburgh, UK.

Tips for using vertical bars

You can use: 

  • Another data reference after the vertical bars rather than a typed value, or
  • Multiple vertical bars to handle several scenarios.

Mix text and data references

In most modules, you can combine written text and data references. Type out the parts of the email that should always be the same and use data references for the parts that might change, such as the name of a recipient or a date.

If you built the weather workflow in the Start a blank workflow for US Weather Service article, you might have noticed that the URL used in the API call to the US Weather Service contained two data references.