Help

Re: How to add New options to Multiple Select option

Solved
Jump to Solution
809 1
cancel
Showing results for 
Search instead for 
Did you mean: 
medfuturexai
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello,

I have three columns with multiple select options: Lecture (Mandatory), Lecture (Required), and Lecture (Optional). I want to automate the process so that if I add a new value to Lecture (Mandatory), it automatically gets added to the other two columns.

For example, if "English Lecture" is added manually to Lecture (Mandatory), then "English Lecture" should also be added to the multiple select options of Lecture (Required) and Lecture (Optional). 

How can i do that using automation 

I have make some small automation but it is not working

Set the Trigger:

Choose the trigger "When record matches conditions."
Set the condition to monitor the "Lecture (Mandatory)" field for updates.

 

 

 

 

 

 

 

let table = base.getTable("Your Table Name");
let recordId = input.config().recordId;

// Fetch the record that triggered the automation
let record = await table.selectRecordAsync(recordId);

// Retrieve the values from the multiple select fields
let certificatesM = record.getCellValue(" Lecture (Mandatory)") || [];
let certificatesR = record.getCellValue(" Lecture (Required)") || [];
let certificatesO = record.getCellValue(" Lecture (Optional)") || [];

// Convert multiple select field values to arrays of option names
let existingValuesR = certificatesR.map(option => option.name || '');
let existingValuesO = certificatesO.map(option => option.name || '');

// Convert the new values to an array of names
let newValuesM = certificatesM.map(option => option.name || '');

present
let updatedValuesR = [...new Set([...existingValuesR, ...newValuesM])];
let updatedValuesO = [...new Set([...existingValuesO, ...newValuesM])];

// Convert the updated values back to the format expected by Airtable
let formattedValuesR = updatedValuesR.map(name => ({ name }));
let formattedValuesO = updatedValuesO.map(name => ({ name }));

// Update the record with the new values
await table.updateRecordAsync(recordId, {
"Lecture (Required)": formattedValuesR,
"Lecture (Optional)": formattedValuesO
});

 

 

 

 

 


                                                    

1 Solution

Accepted Solutions

Trigger:

Sistema_Aotearo_0-1722581702169.png

Action 1: Update Record

Sistema_Aotearo_1-1722581734469.png

Action 2: Update Record, Same thing but leave fields blank

Sistema_Aotearo_2-1722581764327.png

 


Justin Ng
Programme Coordinator at Sistema Aotearoa
https://www.sistemaaotearoa.org.nz/

See Solution in Thread

5 Replies 5

If I'm understanding correctly, you looking for:

Trigger: When {Field A} updates.

Action: Update Record

  • Record ID: (From Triggering Record)
  • {Field B}: Field A
  • {Field C}: Field A

Shouldn't need a script for that. Unless I'm missing something. Let me know.


Justin Ng
Programme Coordinator at Sistema Aotearoa
https://www.sistemaaotearoa.org.nz/
medfuturexai
5 - Automation Enthusiast
5 - Automation Enthusiast

@Sistema_Aotearo I don't want to update the Record. Should Updating Record is necessary? 

If I understand correct the update record place the same Value English Lecture to other two column?

I want to Update the multiple Select options. Currently I have the options in  Lecture (Mandatory), are "Python Lecture" , "C++ Lecture". But I don't have   "English Lecture" in multiple select option. 

 

 When "English Lecture" is added manually to Lecture (Mandatory) options, then "English Lecture" should also be added to the multiple select options of Lecture (Required) and Lecture (Optional). 

 

You want to add the option without making them selected.

I think the setup I mentioned does indeed add to the Multiselect options.

You can then just add an additional step to make those fields blank again. 🙂


Justin Ng
Programme Coordinator at Sistema Aotearoa
https://www.sistemaaotearoa.org.nz/

@Sistema_Aotearo  Can you please provide screenshot/picture for it. so that i can run it smoothly.

Trigger:

Sistema_Aotearo_0-1722581702169.png

Action 1: Update Record

Sistema_Aotearo_1-1722581734469.png

Action 2: Update Record, Same thing but leave fields blank

Sistema_Aotearo_2-1722581764327.png

 


Justin Ng
Programme Coordinator at Sistema Aotearoa
https://www.sistemaaotearoa.org.nz/