Use list actions in Shortcuts on iPhone or iPad
When working with multiple items in a shortcut, use List actions to create ordered lists of data that are passed onto the next action in a shortcut. You can also use List actions to narrow lists — manually or automatically, limiting what’s passed on to the next action. There are three List actions: List action, Choose from List action and Get Item from List action.
Use the List action, to create an ordered list of content, by entering text or by inserting variables. When the shortcut is run, the contents of the List action are passed into the next action. If you pass a list into a Quick Look action, you can preview each item in the list one at a time.
For example, the List action might work for a simple menu of choices for filling out a text field or as a series of album titles to choose from.
The List action can also hold variables. For example, you can use the List action to group multiple types of content together, such as a file, a photo and a location. Then you can pass that list into another action or use those items later.
If a variable is added in a text string in the List action, the variable is forced into text and is inserted into the list item.
Arranging variables in a List action is similar to manually adding variables one at a time using the Add to Variable action.
Choose from List action
Use the Choose from List action to present a menu of options when the shortcut is run. For example, you could use the Get Upcoming Events action to grab 15 of your upcoming Calendar events, then follow that action with the Choose from List action. When the shortcut is run, a menu of 15 Calendar events appears, prompting you to choose one.
The Choose from List action can display rich previews (such as images or map locations) in the menu of options when the shortcut is run. For example, you can use the Get Latest Photos action to grab the five latest images from a photo album, then follow that action with the Choose from List action. When you run the shortcut, a menu of five images appears, prompting you to choose one.
Tip: To set a custom name for an item that an action outputs, such as an image in the Get Latest Photos action, place a Set Name action in between the Get Latest Photos action and the Choose from List action. When the shortcut is run, the custom name (rather than the default name, such as “IMG_0365”), is applied to the image output from the Get Latest Photos action.
If you use the Choose from List action with the Dictionary action, all the keys in the dictionary are displayed when you tap “Add new item”. For each key you select, such as Number, Boolean or Array, the corresponding values are passed as output.
When you run the shortcut, the Choose from List action displays the keys you defined in the Dictionary action.
By default, at runtime Choose from List prompts you to choose a single item, but you can turn on Select Multiple to allow multiple items to be selected when the action runs. When Select Multiple is turned on, the Select All Initially option becomes available. Turn on Select All Initially to have all the items in the list selected by default then, when you run the shortcut, manually deselect the items you don’t want to add.
Note: The output of the Choose from List action is available as a Magic Variable, so that the content you choose can be used later and multiple times, throughout your shortcut.
Get Item from List action
Use the Get Item from List action to automatically narrow down a list of items when the shortcut is run. In the shortcut editor, place the Get Item from List action after an action that contains a list of options, then set the Get Item from List action to retrieve a single item from the list (the first item, last item, a random item and so on). You can also set the Get Item from List action to choose a list by its index — that is, its order in the list. In Shortcuts, the first item in a list has an index of 1.
You can also retrieve multiple items from the list by providing a range of indexes. For example, if you pass a list of six items into the Get Item from List action and set the index to three, the third item in the list is retrieved at runtime. If you pass a list of six items into the Get Item from List action and set the index to a range between three and six, the third, fourth, fifth and sixth items in the list are retrieved at runtime.