Skip to main content

comma separated text string to a multiple select field??

  • August 23, 2024
  • 3 replies
  • 73 views

Forum|alt.badge.img+3
  • New Participant
  • 1 reply

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

TheTimeSavingCo
Forum|alt.badge.img+31

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

Link to base


Forum|alt.badge.img+3
  • Author
  • New Participant
  • 1 reply
  • September 25, 2024

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


TheTimeSavingCo
Forum|alt.badge.img+31
  • Brainy
  • 6457 replies
  • September 26, 2024

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?