I am new to the scripting app. I have a form that people fill out when they come to my office. It feeds into a table called Arrivals (QR Code). I want to create an automation that will run a script when the form is submitted:
- If the person is a guest, they submit their email.
- When the record has that guest email, I want to check another table, Data About People, to see if there’s a record there for them.
- If yes, link the Data About People record to the newly created Arrivals (QR Code) record.
- If no, create then link.
I’m getting an error with this code:
let mainTable= base.getTable("Arrivals (QR Code)");
let mainTableRecords = await mainTable.selectRecordsAsync();
let lookupTable = base.getTable("Data About People");
let lookupRangeRecords = await lookupTable.selectRecordsAsync();
for (let record of mainTableRecords.records) {
let lookupValue = record.getCellValue("Guest Email");
for (let rangeRecord of lookupRangeRecords.records) {
if (rangeRecord.getCellValue("Email") === lookupValue) {
let returnValue = rangeRecord.id;
mainTable.updateRecordAsync(record, {
"Guest": returnValue
});
}
}
}
The error message:
Error: Field “fldwtE0s49vY9FBb9” cannot accept the provided value.
at main on line 14
Many thanks to anyone who can help get this thing running!