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