Lists (Arrays)
How to Create a List
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.
1. A Step Output representing a list of app objects
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

2. A Step Output containing a (nested) field that's a list of items
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.

3. A Step Output containing a (nested) list of app objects
For example, a Deal object from HubSpot contains Lists of associated Compenies, Contacts, Tasks, and many others.

How to Work with a List
Iterators: perform actions for each item in a List
Once you have a list of items, the most common thing you'll want to do is to perform an action for each item in the list (e.g. upload each attachment to Google Drive). Iterators let you perform one or multiple actions for each item in a list. Read more about Looping (Iterators)here.
Use your List as input for an AI step
Another very common use case is to analyze or synthesize a list of data using AI. For example, to create a digest of a list of newsletters or get combined insights from customer calls. In this case, you'll create a "prompt any model" AI step and use the list as input in data for previous steps.
This technique is demonstrated at 1:35 of this video:
Unroll or Combine list data as Text [Advanced]
If you want to create a text representation of a list in e.g. a a bulleted list in an Email body, and you don't want to simply use an AI step to do the formatting for you, you can used the more advanced 'Unroll' feature to create custom formatted text from a list.
The 'Unroll' feature lets you do this in multiline text inputs, and the 'Combine' feature for single-line text inputs.


Unroll List data using a custom template structure
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.

For a detailed demonstration on how to unroll a list, you can check out this video:
Combine List data into a comma-separated list
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.


Using the Size of a List
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.

Explicitly selecting the first item from a List
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.


Last updated
Was this helpful?