Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Automation Scripting Multiple Inputs on List of Records

Topic Labels: Scripting extentions
1358 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Sam_S1
4 - Data Explorer
4 - Data Explorer

Hi - I’m new to scripting so hoping this is an easy resolution! I’m making an automation to update a record based on if the values in two different columns are equal. If they’re equal, I’d like to set another column value as one thing (Booked), otherwise set it as something else (Not Booked).

In my automation, I find the records I’d like to check and can access their record IDs in the script. I can also get the values of the two columns I’d like to compare (teacherNameList and bookedTeacherList). I’m having trouble accessing the values of the teacherNameList and bookedTeacherList… I know that the first record pairs with the first value of the teacherNameList and the BookedTeacherList – is there a way to put these together and loop through?

I think I can do this by accessing the entire table and then finding the recordIDs, and using “getCellValue,” but since I already have the values from finding them in the previous automation step I feel like there’s a better way. I imagine the code something like

for (i = 0; i <records.length;){
    if(teacherNameList[i] === bookedTeacherList[i]){
        await table.updateRecordAsync(records[i], {
    <update>}
    })
    }
    else {
        await table.updateRecordAsync(records[i], {
    <update>}
    }
}

Screen Shot 2022-02-26 at 5.17.06 PM

0 Replies 0