Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

comma separated text string to a multiple select field??

Topic Labels: Automations
711 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Taout
4 - Data Explorer
4 - Data Explorer

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
});
}




3 Replies 3
TheTimeSavingCo
18 - Pluto
18 - Pluto

Hmm, I think you can do this without a script:

Screen Recording 2024-08-24 at 11.24.04 AM.gif

Screenshot 2024-08-24 at 11.24.40 AM.png

Link to base

Taout
4 - Data Explorer
4 - Data Explorer

can it be done dynamically? It seems like your option requires a person to click on it.

You mentioned that you've set up the trigger fine, so you'd just use whatever trigger you've already set up?