Hi!
I am using an automation to run a script when a record is created in SIGNUP table. The script should link the records (which are people) between two tables—SIGNUP and CUSTOMERS. The primary field in both tables is the person’s name but it is easiest to match the records via the email addresses. I am getting an error saying that the link field cannot accept the value. I am using the input variable. See photo.
let recordId = input.config().recordID
let trainingTable = base.getTable(“SIGNUP”)
let recordQuery = await trainingTable.selectRecordsAsync()
let recordToUpdate = recordQuery.records.find(record => record.id == recordId)
let trainingEmail = recordToUpdate.getCellValue(“SIGNUP EMAIL”)
let applicationsQuery = await base.getTable(“CUSTOMERS”).selectRecordsAsync()
let applicationsToLink = applicationsQuery.records.map(applicationRecord => {
if (applicationRecord.getCellValue(“CUSTOMERS EMAIL”) === trainingEmail) {
return { id: applicationRecord.id }
}
})
await trainingTable.updateRecordAsync(recordId, {
“SIGNUP LINK FIELD”: [{id: applicationsToLink.id}]
})

