Oct 12, 2022 01:38 PM
Hello, I am trying to create an automation for assign shifts to contractors.
Here is the current structure:
Step 1 and 2 function just fine. I know that Step 3 will require a script.
I used a few of the previous help posts for this subject on the forum to piece together a script that I believed would get the job done.
Here is the script:
let inputConfig = input.config();
let newRecord = inputConfig.newRecord;
let records = inputConfig.listOfRecords;
let table = base.getTable(“Scheduling”);
let queryResult = await table.selectRecordsAsync({fields: [“Confirmed”]});
for (let record of records) {
let recordObj = queryResult.getRecord(record)
await table.updateRecordAsync(recordObj, {
‘Confirmed’: [
…recordObj.getCellValue(‘Confirmed’),
{id: newRecord}
]
})
}
I get the following error when running:
TypeError: recordObj.getCellValue is not a function or its return value is not iterable
The value of the the “Confirmed” field at the moment is null (it is blank). I know this likely has something to do with it but I cannot figure out what needs to change.
The script is pulling in the correct values for “newRecord” (the record that triggered the automation) and “records” (all records that need to be updated from step 2).
I attempted to query the “record” string inside of the loop after reading that .getCellValue needs the record object to execute, but this did not help.
Oct 13, 2022 10:26 PM
Hey man, if you could invite me to your base I could help you troubleshoot this