Hi all! I’ve been working on utilizing scripting within automations for a project. When a record in a table “MPList” is updated, I want to see if that record’s sort name matches any sort names in another table “memList”. If there is a match, I want the trigger record (from MPList) to be updated.
I’m attaching my code below, and I think that one issue I’m running into may be with the input.config() process. The “toMatch” string in the test output window displays the ID, Name, and color for the text field it was pulled from. So, I’m not sure whether the Name of toMatch is correctly being tested for equality with the “Sort Name” field from the other sheet on line 9.
let toMatch = input.config().toMatch;
let mpList = base.getTable("Imported");
let memList = base.getTable("Members");
let query = await memList.selectRecordsAsync();
let result = false;
let member = false;
for (let record of query.records) {
if (record.getCellValue("Sort Name") == toMatch) {
await mpList.updateRecordAsync(record, {
"Member": true });
member = record.getCellValue("Sort Name");
result = true;
break;
}
}
output.set("matchFound", result)
output.set("tested", member)
Any help would be much appreciated! Thank you so much.