I am trying to take a comma separated value from one field (field name "Interests from MS"), and populate the individual items in that string as individual items in a different multiple select field (field name "Interest"), whenever it's updated. I set up the trigger fine, but I can't get the script right. Is this doable without a custom automation (ie. script)? If not, anyone have any suggestions on a script for that? ChatGPT is unable to get it right for me. This is what it was giving me:
let table = base.getTable("Members");
// Get the record ID from the automation input
let recordId = input.config().recordId;
// Fetch the record using the record ID
let record = await table.selectRecordAsync(recordId);
// Get the value from "Interests from MS" field
let interestsString = record.getCellValue("Interests from MS");
if (interestsString) {
// Split the string by commas and trim any extra whitespace from each item
let interestsArray = interestsString.split(',').map(item => item.trim());
// Update the record with the array as a multi-select field
await table.updateRecordAsync(recordId, {
"Interests": interestsArray
});
}