Hi all,
I'm very new to scripting and am struggling with the syntax to write to a multiple select field.
I have single select fields ("Monday AM", "Monday PM", "Tuesday AM", etc) that can be Y, N, or blank.
I have formula fields ("First Monday AM", "First Monday PM", "First Tuesday AM", etc) that calculate a date based on a user-entered date.
I have a multiple select field called "Availability". If "Monday AM" is Y, I want to pick up the date from "First Monday AM" and put it into "Availability."
Here is my code:
let scheduleArray = [];
if (r.getCellValueAsString("Monday AM") == "Y") {
monAM = r.getCellValue("First Monday AM");
scheduleArray.push(monAM);
}
if (r.getCellValueAsString("Monday PM") == "Y") {
monPM = r.getCellValue("First Monday PM");
scheduleArray.push(monPM);
}
await s.tableSource.updateRecordAsync(r, {"Availability" : scheduleArray});
Error:
Can't set cell values: invalid cell value for field 'Availability'. Cell value has invalid format: <root>.0 must be an object, <root>.1 must be an object Multiple select field value must be an array of objects with at least one of 'id' or 'name' as a property.
I don't know how to fix the code to make my array into objects and how to use 'id' or 'name.'
Thanks in advance!