- 08 Aug 2024
- 4 Minutes to read
- Print
- DarkLight
- PDF
Airtable automation action: Sort list
- Updated on 08 Aug 2024
- 4 Minutes to read
- Print
- DarkLight
- PDF
All plan types with varying limitations | |
| |
Platform(s) | Web/Browser, Mac app, and Windows app |
Related reading | Creating an automation - Learn how to set up your first automation in Airtable. |
In automations where you have already used a “Find records” automation action, you can add an additional automation action to then sort the records that are found. This way, in later automation action steps, the list of records can be processed in an expected format. Read on to learn more about how to set up this type of automation action and the expected behavior and known limitations.
Note
Your automation must contain at least one “Find records” action in order to add and configure a “Sort list” action.
Setting up an automation to sort a list of records
Step 1: Create a new automation or navigate to a previously configured automation
Create a new automation - To start creating an automation, from the open base of your choice click on Automations in the upper left corner of your screen to open the automation configuration window. Click the + Create automation option to begin the setup process. If you would like, you can rename the automation right away to make it easier to understand what it does. Move on to step 2 below.
Navigate to a previously configured automation - To select an existing automation containing a “Find records” action, from the base containing the automation you want to modify, click on Automations in the upper left corner of your screen to open the automation configuration window. Find the automation containing an existing “Find records” action. Skip to step 4 below.
Step 2: Configure a trigger
Next, you will need to click + Add trigger option. Once clicked, the available triggers will display for you to choose from. Click here to learn more about all available automation triggers . Once you have configured and tested the trigger, you can move on to the next step.
Step 3: Add a “Find records” action
Click the + Add advanced logic or action option.
Scroll down in the menu that appears, then find and click on the “Find records” option.
Configure this action to fit your needs. If you need more information about setting up the “Find records” action, consult the following documentation.
Step 4: Add a “Sort list” action
Click the + Add advanced logic or action option or click the + button that appears in between the existing “Find records” action and another action in your automation’s configuration.
Next, select the Sort list option.
Step 5: Configure the “Sort list” action
Feel free to enter a description of what the action will do. You can always add one later if you prefer to skip this step.
Under “Configuration,” click the blue Select input list button.
Next, click the “Find records” action step that you would like to sort, then click the Use as a list token option. Some automations may contain multiple “Find records” steps, so be sure to read the short description provided so that you select the correct action. You’ll need to set up multiple “Sort list” actions if you want to sort the outputs of multiple “Find records” actions.
Next, under Sort by configure the conditions to sort based on one or more field conditions. This will modify the list output to be sorted according to your specific sort conditions. The order can either be Ascending or Descending and will depend on the field type related to the condition you are configuring.
Note that fields are compared in order. So, if the fields "First Name" and then "Last Name" are selected, "Last Name" will be used to compare records that have the same value for "First Name.”
We provide more guidance about unsupported field types in this section.
Now, you can click Test action and then scroll down to the "Sorted items” section to get a preview of what the sorted output of found records would look like. Click into the Field values if needed, to glean details about each record in the list. If needed, go back and adjust any of the configuration parameters discussed above.
Step 5: Add another action to utilize the found records
After you've found and sorted the records you are looking for, you can add another action to determine what step to take with those records (as long as at least one record was found).
One example workflow would be to find a list of records with impending due dates and sort those records “Ascending” (soonest due date first), then use the "Send email" action to automatically email those records to the people on your team for review. You are free to use any automation action that's most helpful for your workflow.
Below you can see the set up of an automation similar to the example provided above:
![automation_sort_list_example_configuration_2024.png](http://cdn.airtable.document360.io/d0ee2ee4-3f78-47c7-b388-85e40be9fb89/Images/Documentation/automation_sort_list_example_configuration_2024.png)
Limitations and dependencies
Unsupported field types
Lookup fields
Multi-select fields
Foreign key fields (i.e. fields linking to other records)
Attachment fields
Button fields
Multi-user fields. Single user fields can be used as a sort field. In this case, the user's name will be used to sort.
Miscellaneous limitations and dependencies
The “Sort list” action only accepts record arrays returned by the "find records" action as an input from a previous step in the automation you are configuring. Record arrays returned from the "Custom script" action are not valid inputs to use with a “Sort list” action.
Sorting a record list array before using it as an input to a repeating group of automation actions does NOT affect the processing order. We do not offer any guarantees with regards to the order in which a repeating group of actions are processed.
Any records that don't have a value for a chosen sort field will show up last in the sorted list, regardless of whether the selected order is ascending or descending. In other words, if the sort field is "Name,” then records with an empty "Name" field will always show up last in the list of records.