Link Record by Email

Hi There! I am just trying to jump in as we are working on data migration for a client. I need to be able to take a table (“Job Applications”) and search for a record in another table (“Applicants”) using a field (“Email Address”) as the lookup. Once the record is found, I would like to link the (“Applicants”) record to the (“Job Applications”) record. I have 10,000 records to scrub, so my current zap is laughable.

Thanks for your help!

There are many reasons to laugh about some things that people try with Zapier.

I predict 102 lines of script in a block would do it.

1 Like

Here’s the code I came up with!

//Define the table and query
let jobTbl = base.getTable(“Destination Base”);
let appQuery = await jobTbl.selectRecordsAsync();

//Loop through the records and find the Applicant
for (let record of appQuery.records) {
let appname = record.getCellValue(“Matching Term”);

//Define linked table and query
let applicantTbl = base.getTable("Other Dataset");
let applicantQuery = await applicantTbl.selectRecordsAsync();

//Loop through linked table and match ID values
for (let appRecord of applicantQuery.records) {
    if (appRecord.getCellValue("Matching Term") === appname) {
        let inputid = appRecord.id;
 
        //Update field
        jobTbl.updateRecordAsync(record, {
            Field To Link: [{id: inputid}]
        });
   }
}

}

It works well, wanted to share and it saves hours of life.

3 Likes