Find records automation action
  • 24 Aug 2022
  • 6 Minutes to read
  • Dark
    Light

Find records automation action

  • Dark
    Light

When building an Automation, you may choose the “Find records” action. This will look for records matching specific conditions that you can specify within the action settings.

Setup

Prior to adding this action, you’ll need to configure an automation trigger. You can learn more about each available trigger here. Once you’ve configured and tested the trigger you can move on to adding the “find record” action.

Add a “Find records” action

Once your automation trigger is configured and tested you can add an action. Start by clicking the “Add action” button under the trigger step, and then select the “Find records” action.

6615841621015findrecordsactionconfigempty.jpg

Next, you'll see that you will need to choose between finding a record based on conditions or records within a certain view. In our example, we will choose to find records based upon a condition. But you can learn more about finding records in a certain view in a later section of this article.

6615842087447findrecordsactionsconfigspotlightviewchoice.jpg

In the example below, we want to find records where the due date is equal to today’s date. Note that the conditions are set where the "Due Date" field is today.

4402381484439dueDateTodayCondition.jpg

You can choose to combine conditions using either an “And” conjunction or an “Or” conjunction. To learn more about constructing conditions please see this support article.

your title goes here

There is a limit of 100 records per find records action. If you have a view or condition that returns more than 100 records, then adding multiple find records steps to query different views or conditions is currently the best workaround.

Static and dynamic conditions

While setting up the "Find records" action you may notice a small cog icon ⚙ next to the condition that you are setting up. Clicking on the cog will bring up a menu to choose from static or dynamic values.

6615843040151findrecordsactionconfigspotlightstaticdynamic.jpg

Static conditions are values that you manually add in order to look for the same value in a certain field every time. Dynamic conditions will change depending on the variables set up in a previous step in the automation you are building out. After clicking the "Dynamic" option you should see a blue and white plus sign icon appear in that condition's setup window.

6615862092055findrecordsactionconfigspotlightdynamiccondition.jpg

TIP

If you'd like to insert the entire value of a field into your condition as is click the "Insert" button. Certain field types will allow you to insert other properties about that field like the length of the text or color of that field. If you'd like to see what other data is available for the selected field type then click the "Continue" button.
4415390464663insertorcontinue.png

Any conditions you set will default to the static conditions option, so anytime you want to use a dynamic condition you will need to change it to be dynamic via the cog menu.

Finding records based on a view

Sometimes you may have already set up certain conditions in a view using filters or hidden fields in a view in your base. In these cases, rather than recreating the same conditions in the find records automation action, you can simply choose to find records in that view.

While setting up the "Find records" action step you will see an option to choose to find them based on a view.

4402384156951findRecordsView6921.jpg

Next, select the view that you would like the automation to find records within. As a reminder, don't forget to test the action step at this point.

6615886630039findrecordsactionsconfigchooseviewandtest.gif

If you “Find Records” based on a view, and then render those recordsas an HTML list or grid in an email, the records will be rendered in the same order as they were in the view. The way that fields have been ordered within that view will also be rendered in the same manner.

This means that you can use the following workflow to send an email with a custom order for your records:

  1. Create a view and sort the records and fields however you like.
  2. Set up an automation, that when triggered, will use the "Find Records" action to find records based on your previously created view.
  3. Use the "Send email" action to send an email rendering the records you just found, as either an HTML list or grid, in the same order as they were presented in your view.
your title goes here

We do not currently support rendering "Found" records in their view order if the records have been grouped.

To learn more about the basics of sending emails via automations check out this article.

TIP

In actions that include the option to render found records as a list or grid, such as the "Send email" action, there is an option to include a link to the view where the rendered list or grid of records is coming from.

4402384706967findRecordsRenderAddLink6921.gif

Run a test

Once this is configured, make sure to test the action by clicking “run test”. Running a test confirms that the action is configured correctly, and saves record data to use in later steps.

5152715250711automationsFindRecordsTest.jpg

Preview of found records

When testing the Find records action, a preview of the records found based upon the view or condition(s) you have set will pop up.

5152771118871automationsFindRecordsActionTestPreview03312022.gif

If you want to see the test result at a later point in time, then you can click the "View result" button in the Results drop-down.

5152848657687automationsFindRecordsActionViewResult03312022.gif

your title goes here

The preview you see will include all fields, even those hidden in a connected view. This is because the test is showing what our system sees on the backend. This is important because hidden fields may still be included in later actions. For example, if you include records found in the Find records action in a Send email action, then you will decide in the Send email action’s setup process which fields should be hidden in the email that is sent.

Add a following action

After you've found 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).

For example, if your "Find records" action found one record, you can choose to update that record using the update record action. Note that the "update record" action only supports updating a single record. Meaning, that you can use the "Find records" action to find and pass a single record to the "update record" action to update that record.

Another example workflow would be to find a list of records with impending dates, then use the "Send email" action to automatically email those records to a colleague. You are free to use any automation action that's most helpful for your workflow!

TIP

If you'd like to see an example of using the "Find Record" action in a multistep workflow (coupled with the "Update Record" action) check out this guide on linking existing records.

FAQs

Why aren't the date, or time-based, conditions in my "Find records" action, conditional logic, or "When a record matches conditions" trigger evaluating correctly?

Automations run on GMT since that is the default timezone that Airtable operates on behind the scenes. When setting up time-based conditions in Automations you may need to adjust times manually or create a formula to auto-adjust times so that the conditions evaluate according to your timezone.

Is there a way to stop an automation's run if the "Find Records" action does not find any records?

There is not currently a way to natively terminate an automation based on the "Find records" action step. However there is a workaround in which you can insert a "Run Script" action after the "Find records" step to achieve this —check out the video here to guide you through how to do it !

Here's the script in the video above (Note : you will still need to set the input variable as shown in the video):

let numRecordsFound = input.config().numRecordsFound;if (numRecordsFound < 1) {throw Error("No records were found.")}

An alternate method to involves a second automation and an extra table—here's how. It will log how many records were found into another table, and then that can be used as a trigger in a second automation.


Was this article helpful?