Linking existing records using automations
  • 02 Mar 2023
  • 4 Minutes à lire
  • Sombre
    Lumière
  • PDF

Linking existing records using automations

  • Sombre
    Lumière
  • PDF

The content is currently unavailable in French. You are viewing the default English version.
Article Summary

The more comfortable you get with automations, the more you’ll come to realize their flexibility in being leveraged in complex workflows. This article will go over how to set conditions to update existing records in your base. We’ll show how to both find records across tables and update existing records.

This article showcases the “When record matches conditions” trigger, and the “Find Record” and “Update Record” actions.

Prerequisite setup

For this demo we’ve set up two tables, Projects and Tasks, that are linked directly together using a linked record field.

You can see our table set up below, and can copy this base if you’d like to follow along with the rest of this demo.

For our example workflow, every time we add a new project we’d like to link the same three tasks to that project:

1500018151402image6.png

As you can see above our new project, Project D , will also need to be linked to the same set of Regular Tasks as all the previous projects. Now, we could go in and manually link every task, but that is time consuming and error prone.

Automations to the rescue! The automation we’ll be crafting will add the tasks we specify to a project based on a condition we set. A common pattern for setting up a new automation is to create a checkbox field that can be used as the condition for triggering that automation.

So with that in mind, the first thing we will do is create a checkbox on the Projects table that we can use as an easy trigger to kick off this automation.

1500018441861image2.png

With our checkbox in place we are up to begin creating our automation. We have three goals this automation will need to accomplish:

  1. Identify the project to be updated (using the checkbox we just made)
  2. Find all the Tasks that need to be linked to this project
  3. Update the project that triggered this automation with the tasks we found in the last step

Choosing a trigger

So we will start by creating a new automation and choosing the “When record matches conditions” trigger to take advantage of our new checkbox field. We can add a further condition to make sure our project has both the checkbox checked, and no other Tasks linked.

6616147207447linkexistingrecordsguideconfigurewhenrecordmatchesconditionstrigger.jpg

After testing out our trigger step, we can move onto setting up our two actions.

Setting up an actions

So we have accomplished the first of our three goals. We can now move on to steps two and three:

  1. Identify the project to be updated
  2. Find all the Tasks that need to be linked
  3. Update the project that triggered this automation

Find records action

We now need to find all the records on the Tasks table that we’d like to link to this new project record. For our example, we know all the Tasks we’d like to link to have the same word (i.e. “Regular”) in their name field, which we can use to our advantage.

We can set up a Find Records action to find all the tasks that have the word “Regular” as part of their {Name} field.

6616143951255linkexistingrecordsguideconfigurefindrecordsaction.jpg

Now we can test this step to ensure that three record were found based on our search:

1500018442441image5.png

Update records action

Now we can tie everything together in our third step:

  1. Identify the project to be updated
  2. Find all the Tasks that need to be linked
  3. Update the project that triggered this automation

Setting up our final step, using the “Update Record” action, we will update the project record that kicked off this automation. Note that when using the “Update Record” action we always want to make sure we choose the table where the record we are updating is located.

In this case we are updating our triggering project record, which can be found in the Projects table.

6616148979735linkexistingrecordsguideconfigureupdaterecordsaction.jpg

We know we have a reference to the project we’d like to update from our triggering step, because that project record triggered this whole automation! So we can choose to use the Record ID from our first step.

6616136545559linkexistingrecordsguideconfigureupdaterecordsactionchooserecordid.gif

TIP

The “Update Record” action only accepts the Record ID of the single record that will be updated. However, linked records are bidirectional—so when we update a linked record field the other side of that link is updated too. Meaning, that not only are we updating the project record above, but we are also updating each newly-linked task record to have a reference to that project record.

Now that we’ve identified which record to update, we can choose what fields should be updated and the values to use for the update. We’ll be updating our project’s {Tasks} linked record field—so we can choose that field, then input the value of the Task records we previously found with our automation’s “Find Records” action.

6616163986583linkexistingrecordsguideconfigureupdaterecordsactioninsertmultiplerecordids.gif

TIP

When linking multiple records using an automation, make sure to choose to “Make a new list” of “Airtable record IDs”.

After conducting our final test, and switching our automation on, we can now see our workflow in action.

1500018442421image3.gif


FAQs

How do I "pull in" data from linked records?

To "pull in" data from records that have been linked you may need to add lookup, rollup, or count fields that will return data according to the record(s) that have been linked.


Cet article vous a-t-il été utile ?