Aug 23, 2024 11:53 AM
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
});
}
Aug 23, 2024 08:25 PM - edited Aug 23, 2024 08:26 PM
Sep 25, 2024 04:49 PM
can it be done dynamically? It seems like your option requires a person to click on it.
Sep 25, 2024 07:36 PM
You mentioned that you've set up the trigger fine, so you'd just use whatever trigger you've already set up?