Hello, I have a script that is intended to copy a set of predefined task records whenever a new project is created. The problem I am running into is with the multiple-select columns. The documentation says that I should be able to write to a multi-select column using the selection ids, but I always get this vague error when testing despite having no syntax/linting errors:
“ERROR
Error: Field “Phase” cannot accept the provided value.
at on line 30
at main on line 15”
Here is my script, plus a picture of the error:
// get respective project
const inputConfig = input.config();
const project = {id:inputConfig.project};
// get tables
const sourceTable = base.getTable("Source");
const destTable = base.getTable("Dest");
// get all template tasks
let query = await sourceTable.selectRecordsAsync();
// for making dynamic functionality later
// TODO: make dynamic functionality later
let cols = sourceTable.fields;
let getColName = (c) => { return c.name; };
let colNames = cols.map(getColName);
query.records.forEach((r) => {
// get phases
let phases = [];
if (r.getCellValue("Phase")) {
for (const x of r.getCellValue("Phase")) {
console.log(x.id);
phases.push({
"id":x.id
});
};
}
// create task record
// TODO: figure out what the problem is with Phase and Who does Task Involve
let cra = destTable.createRecordAsync({
"Task": r.getCellValue("Task"),
"Phase": phases,
"Task Owner": r.getCellValue("Task Owner"),
//"Notify Collaborator(s)": r.getCellValue("Notify Collaborator(s)"),
"Start Date": r.getCellValue("Start Date"),
"End Date": r.getCellValue("End Date"),
// "Who does Task Involve": r.getCellValue("Who does Task Involve"),
"Project": [project]
});
// console.log(cra);
});
Everything works fine except for the multiple-select columns. Am I missing something?