Help

Using Airtable automation to append data from two linked fields

Topic Labels: Automations
1854 4
cancel
Showing results for 
Search instead for 
Did you mean: 
Kongtho_Imarith
5 - Automation Enthusiast
5 - Automation Enthusiast

We use automation to combine records from more than one field and find that they remain in the automation field when a record is deleted from one of the original fields. Is there a way to remove these linked records from the automation field when they are removed from the trigger field? We don’t want to clear all the linked records, just the removed ones.

 

 

4 Replies 4
Stephen_Orr1
10 - Mercury
10 - Mercury

Hi @Kongtho_Imarith,

Are you looking to delete the linked records that are no longer necessary?

If so, you'll need to use an automation script step with the following code:

//DELETE UNLINKED RECORDS VIA AUTOMATIONS
//Usage: On record updated trigger, if linked record field is emptied then delete self
//Automation variables: trigRecID as trigger record ID, linkedRecField as trigger rec linked record field

let config = input.config()
let table = base.getTable('YOUR_TABLE') //replace w/ trigger record's table

!config.linkedRecField.length && await table.deleteRecordAsync(config.trigRecID)

Hope that helps!
-Stephen

 

 

Sho
11 - Venus
11 - Venus

If it can be generated by Automation (without scripting), it should also be possible to update or delete it.
How about using the trigger "When record updated" to regenerate when there is a change?

@Sho It's not possible to delete records via Airtable automations without scripting.

@Kongtho_Imarith If you're not looking to delete records (sounds like you aren't but I threw it out there just in case), you can unlink records by using an Update Record action and changing the value of the linked record field.

EdenWheeler
5 - Automation Enthusiast
5 - Automation Enthusiast

Yes, it is possible to remove linked records from the automation field when they are deleted from the trigger field. This can be achieved by implementing logic that detects the deletion and removes the corresponding linked records from the automation field while leaving the rest intact.