Automatically link record based on plain text or formula result

I would like to create a workaround for the issue that Linked Records are not available in Automations.

I am collecting lots of URL inputs from colleagues via the web clipper. For a number of reasons I want to link the records to another table automatically, using a script. The idea would be to trigger the script using an Automation.

In short:
I want the title of the Calculated site to be copied into the linked record field Sites

I feel like this should be fairly simple but I’m not able to dig into JS :confused:


It looks like you’re using a built-in formula field in Airtable to determine the site name. Your overlay says the name is calculated according to IFTTT, which is a third-party integration service, and which can’t change the contents of a formula field. Just for the sake of clarity, please don’t refer to Airtable formulas as IFTTT. The idea of using IF-THEN logic in formulas and programming has been around a lot longer than the IFTTT service. :slight_smile:

Back to your question. If you’re using the web clipper to create those records, you could probably trigger the automation with the “when record created” trigger option. For the script action, set it up to pass the value of the {Calculated site} field into the script as an input variable named “siteName”, and the triggering record ID as an input variable named “recordID”. With that in place, the following script should work. It will link to a record matching the name from the formula. If it doesn’t find a matching record, it will create one and link to it.

let submissionsTable = base.getTable("Submissions");
let siteTable = base.getTable("Sites");
let sitesQuery = await siteTable.selectRecordsAsync();
let config = input.config();

// Find the matching record
let matched = sitesQuery.records.filter(site => {return === config.siteName});
let siteRecord;
// If a matching record exists, use it; otherwise make a new record
if (matched.length)
    siteRecord = matched[0];
    siteRecord = await siteTable.createRecordAsync({"Name": config.siteName});
await submissionsTable.updateRecordAsync(config.recordID, {"Sites": [{id:}]});

Amazing, thank you @Justin_Barrett! Worked like a charm.

(I clarified that I refer to the if-then logic, and not the IFTTT service, in the screenshot)

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.