Help

About Linked Record Fields and Using Automation Condition

Topic Labels: Automations
838 1
cancel
Showing results for 
Search instead for 
Did you mean: 
ItsCucumber
4 - Data Explorer
4 - Data Explorer

Hi!

Airtable newbie here. I’m using a Linked Record Field in a Form.

If someone submits the form with having more than 3 linked records/items selected, I would only like to have 3 records/items (max) only recorded in my table.

Any help is appreciated.

Thanks

1 Reply 1

Create an Automation that monitors change within the Linked Field, then you’ll need to run a script that’s similar to this;

In this example, the linked field is a “Tags” table, that the main “Products” table links to - which is from a previous example I gave in another thread.

//Get the record with the "Tag" field change
const inputConfig = input.config();
const productsTable = base.getTable("Products");
const myRecord = await productsTable.selectRecordAsync(inputConfig.recordId);

if (myRecord.getCellValue("Tags").length >= 4) {
    
    let lastThreeRecords = myRecord.getCellValue("Tags").slice(myRecord.getCellValue("Tags").length-3, myRecord.getCellValue("Tags").length);
        
    await productsTable.updateRecordAsync(inputConfig.recordId, {
        "Tags" : lastThreeRecords
    })
};