Hi all, I’m trying to link my a “parent” record to new created records in a script following this source. But I keep on getting the error “TypeError: newRecordId.getCellValue is not a function”.
The code can be found under " /Link the new record (child) to the parent record/".
Thanks for the help in advance… it’s very much appreciated!
let inputConfig = input.config();
let table = base.getTable('Progress General Indicator 🚫');
let projectsTable = base.getTable('Projects 🖌');
let indicators = inputConfig.linkedIndicatorIDs;
let projectID = inputConfig.projectID;
let recordID = inputConfig.recordID;
let linkedIndicators = inputConfig.linkedIndicators;
/*Create new records (children)*/
for (let indicator of indicators) {
console.log(`Adding indicator ${indicator} to the new record.`);
console.log(`Adding project ${projectID} to the new record.`);
let newRecordId = await table.createRecordsAsync([
{
fields: {
/*'Projects 🖌': [{id: projectID}],*/
'General indicators 🖌': [{id: indicator}]
}
}
])
console.log(`Added record ${newRecordId}.`);
/*Link the new record (child) to the parent record*/
let existingLinkedRecords = newRecordId.getCellValue('Optional: Link to other indicators');
table.updateRecordAsync(recordID, {'Optional: Link to other indicators': [existingLinkedRecords,{ id: newRecordId.id }]})
}