I need help writing a script for a trigger

Hi, I’m new to the airtable community, and slowly understanding formulas, but I can’t figure out how to write a script to do the following. This is my base: https://airtable.com/shrVDFgXXjqANyMWd

When I new record comes into this base, I want to set a trigger that checks the bid amount against the current “MaxBid,” and if it is ≤ to it, I want to then make changes to another field in that record. In this case, if the “Bid amount” of the new record is ≤ the “MaxBid,” I want to unlink that record from the “Item bidding on” so that it doesn’t pass unto the other table.

How do I write and IF() script for this? Any help would be greatly appreciated.

Thank you,
Christhian

Welcome to the community, @Christhian_Diaz1! :smiley: I noticed that you tagged both “Formulas” and “Automations” for this topic. Formulas can’t alter other fields, though, but automations can do that pretty easily.

First, make a formula field that compares the {Bid} value against {MaxBid}:

Bid <= MaxBid

That formula will return a 1 when the {Bid} is less than or equal to {MaxBid}, and a 0 otherwise. I’ll name this formula field {Under-Bid}. Now create a new automation using the “When record matches conditions” trigger. The condition should be when {Under-Bid} equals 1.

Next add an “Update record” action, and make sure you’re updating the record that triggered the automation. Add the {Item bidding on} link field, but leave the contents empty. That will clear out that link when the record is updated.

Now when new records come in, that formula will output 0 or 1 depending on the bid value compared to the max. If it’s lower or equal, it will trigger the automation, which will clear the link.

1 Like

@Justin_Barrett Thank you so much! This makes total sense. I was so close to understanding how to do this with automations, but hadn’t quite understood the right way to connect things. This process is also going to be very helpful for me in the future.

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.