Help

Re: I need help writing a script for a trigger

Solved
Jump to Solution
500 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Christhian_Dia1
4 - Data Explorer
4 - Data Explorer

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

1 Solution

Accepted Solutions
Justin_Barrett
18 - Pluto
18 - Pluto

Welcome to the community, @Christhian_Diaz1! :grinning_face_with_big_eyes: 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.

See Solution in Thread

2 Replies 2
Justin_Barrett
18 - Pluto
18 - Pluto

Welcome to the community, @Christhian_Diaz1! :grinning_face_with_big_eyes: 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.

Christhian_Dia1
4 - Data Explorer
4 - Data Explorer

@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.