Help

Re: No duplicate record creation

Solved
Jump to Solution
4396 1
cancel
Showing results for 
Search instead for 
Did you mean: 
kpresley
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi there! 

I have two tables involved in this automation, a Projects table and a Tasks table. Currently my automation is set up so that when a project status changes to "Ready to Build," a series of new records are created in the Tasks table.

I'm running into a scenario where a project might be paused or delayed and moves back to "Pending" status, then back to "Ready to Build" again at a later date. Is there a way to keep the automation from recreating the same set of tasks again?

Thanks! 

1 Solution

Accepted Solutions

Hey @kpresley

The only thing you need to tweak in your search is that you need to configure it so that it reads:

Where {Project} contains {primary field of your project record}

 When you search using the contains operator, Airtable will search against the actual value that's displayed in the linked record field instead of the record object that would return against the record id.
The way it behaves is admittedly a bit backwards.

Here's a quick example for you to reference:

I created a simple base with Projects and Tasks tables.
I have a checkbox field on the Project object that will trigger the creation of the tasks.

Ben_Young1_0-1677272949062.png

Here's how I configured the Find records action:

Ben_Young1_1-1677273050067.png

And here are the test results:

Ben_Young1_2-1677273080480.png

For your conditions, you'll recall that we only want to create the records if none are found.
The Find records action returns an array (list) of found records.

Don't spend too much time trying to understand it if it doesn't make too much sense at first, but here's an example of what the data looks like on the backend when it finds records.

[
    {id, name},
    {id, name},
    {id, name}
]

Each record found in the array (list) is representing by the data in each line with the {id, name} values.
We don't really care about the data that's inside the array. We only care if there is data in the array, since it would mean that there were records found.

To do this, we want to look at the properties of the array. In this case we want to know the length of the array.
A length of zero would mean that no records were found.

Ben_Young1_3-1677273586445.png

The data in this screenshot indicates that our search returned three found records.
We'll set our filter to look like this:

Ben_Young1_4-1677273744630.png

Now, it'll only run if nothing is found.

See Solution in Thread

4 Replies 4

Hey @kpresley

For this, you can do two things.
The first option is to add a Find records action to the start of your automation. It should search your Tasks table for records that are linked to the triggering project record. From there, you'll add a conditional filter that only allows the records to be created if no preexisting records are found in the table.

The second option will be to simply set your automation's conditional filter to create the records if the linked record field to your Tasks table is empty.

If the records already exist, the automation will simply end without anything happening.

Thank you for the information! The Find records action seems like the move here - I think I'm missing something conceptually as I'm going through the process. I've set up a Find records action but I'm a bit stuck on the Conditions that need to be set...

If the Find records action is set to find any records where the Project field matches the record ID of the project in question, how would I set the Conditions to continue running the automation (and create records) based on that Find records action? See attached, in case that helps! 

Hey @kpresley

The only thing you need to tweak in your search is that you need to configure it so that it reads:

Where {Project} contains {primary field of your project record}

 When you search using the contains operator, Airtable will search against the actual value that's displayed in the linked record field instead of the record object that would return against the record id.
The way it behaves is admittedly a bit backwards.

Here's a quick example for you to reference:

I created a simple base with Projects and Tasks tables.
I have a checkbox field on the Project object that will trigger the creation of the tasks.

Ben_Young1_0-1677272949062.png

Here's how I configured the Find records action:

Ben_Young1_1-1677273050067.png

And here are the test results:

Ben_Young1_2-1677273080480.png

For your conditions, you'll recall that we only want to create the records if none are found.
The Find records action returns an array (list) of found records.

Don't spend too much time trying to understand it if it doesn't make too much sense at first, but here's an example of what the data looks like on the backend when it finds records.

[
    {id, name},
    {id, name},
    {id, name}
]

Each record found in the array (list) is representing by the data in each line with the {id, name} values.
We don't really care about the data that's inside the array. We only care if there is data in the array, since it would mean that there were records found.

To do this, we want to look at the properties of the array. In this case we want to know the length of the array.
A length of zero would mean that no records were found.

Ben_Young1_3-1677273586445.png

The data in this screenshot indicates that our search returned three found records.
We'll set our filter to look like this:

Ben_Young1_4-1677273744630.png

Now, it'll only run if nothing is found.

This is perfect, thank you! Makes total sense about the search - I hadn't even considered using the primary field for some reason 🙃 I appreciate all your help with this!