Lists (Arrays)
Last updated
Last updated
Relay.app has various tools to perform operations on lists of data in your workflow. There are three common situations in which you might encounter lists.
For example, a List of Jira tickets obtained through a Find Step by configuring it to return All matching issues in a list.
The Step Output pill will contain a badge with three horizontal lines on top of the app icon, to indicate it's a list of Issues, not just a single Issue
For example, a Step Output representing an Email object from Gmail contains a number of Lists:
Lists of recipients (one for the To-line and CC-lines)
A List of File Attachments
A List of Labels
Note: while [the structure of] every Email object contains these Lists, this doesn't mean that they contain data for every email. e.g. when an Email doesn't have any attachments, the List of Attachments is simply empty.
For example, a Deal object from HubSpot contains Lists of associated Compenies, Contacts, Tasks, and many others.
Iterators let you perform one or multiple actions for each item in a list. Learn more here.
It's quite common to create (bulleted) lists in e.g. an Email body or a Notion page enumerating properties from items in a list.
The 'Unroll' feature lets you do this in multiline text inputs, and the 'Combine' feature for single-line text inputs.
Unrolling a List lets you specify a templated structure that will be repeated for each item in the list. For example, you can use this to create a bulleted list with key information about all currently open Jira issues.
The 'Combine' feature is similar to the 'Unroll' feature, except for that it's hard-coded to concatenate all values in the list separated by commas. You can use this in signle-line text inputs.
All Lists have a Size property. You may use this in a workflow to determine the number of items in the List, and define behavior accordingly. For example, by creating Paths for cases where the List contains 0, 1 or multiple items.
While in the majority of cases you'll want to wrap an Iterator around a list, there may be cases when you want to explicitly pick the first item from a list to perform an action on. For example, your CRM might let you add multiple 'Associated Companies' to a Deal, even though you're only ever adding one at most. In that case, you can probably just use the 'first result'.
This is why Step Outputs for Lists will still show up in data pickers that only accept a single item. You'll see a 'First result' entry that lets you pick the very first result.