Aug 01, 2024 09:23 PM - edited Aug 01, 2024 10:07 PM
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
});
Solved! Go to Solution.
Aug 01, 2024 11:56 PM
Trigger:
Action 1: Update Record
Action 2: Update Record, Same thing but leave fields blank
Aug 01, 2024 11:41 PM
If I'm understanding correctly, you looking for:
Trigger: When {Field A} updates.
Action: Update Record
Shouldn't need a script for that. Unless I'm missing something. Let me know.
Aug 01, 2024 11:45 PM - edited Aug 01, 2024 11:49 PM
@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).
Aug 01, 2024 11:52 PM
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. 🙂
Aug 01, 2024 11:54 PM
@Sistema_Aotearo Can you please provide screenshot/picture for it. so that i can run it smoothly.
Aug 01, 2024 11:56 PM
Trigger:
Action 1: Update Record
Action 2: Update Record, Same thing but leave fields blank