script to copy array of found records to linked field

Topic Labels: Scripting
187 1
Showing results for 
Search instead for 
Did you mean: 
6 - Interface Innovator
6 - Interface Innovator

I'm creating a script between 2 tables: 'Engagements' and 'People'.

  • Engagements is a list of event attendance
  • People is a master list of people

I have a script that, using the attendance sign up info (name, email), tries to find a matching person from the master list. (This step is part of a loop to go through each Engagement record.)


let peopleTable = base.getTable('People');

// find a matching Person record
let personQuery = await peopleTable.selectRecordsAsync({ fields: ['Person IDENTIFIER'] });     
let foundNames = personQuery.records.filter((record) => {
      let name = record.getCellValue('Person IDENTIFIER'); 
      return name == engagement.getCellValue('Person IDENTIFIER'); 


This works fine. Now I need to link all the 'foundNames' to that 'engagement' record.  The linked field is called 'Person' in 'Engagements' table:


let numPeople = foundNames.length;

if (numPeople > 0) {
 await engageTable.updateRecordAsync(engagement, {
 'Person': [{ id: }]


This doesn't seem to be the right syntax. I'm probably missing one more variable. How do I insert the array of all 'foundNames id's to this linked field?


1 Reply 1
6 - Interface Innovator
6 - Interface Innovator

I figured this out:

// create a new array of all matching People found
let foundNamesIDs = => ({id:}));

// update the Engagement with all names
await engageTable.updateRecordAsync(engagement, {
   'Person': foundNamesIDs