Help

Re: Multiple IF conditions in automations instead of IF > ELIF > ELIF > ...

1994 3
cancel
Showing results for 
Search instead for 
Did you mean: 
qoob
5 - Automation Enthusiast
5 - Automation Enthusiast

My goal is to create a single automation, that checks multiple separate fields and if they contain values, process separate actions.

For example, if a new record is created and there are values in the field weight, then update the weight field of the linked record. If a new record is created and there are values in the location field, then update the location field of the linked record.

Now the statements follow an IF -> ELIF (Otherwise if) logic, therefore if a new record is created and both fields (Weight and location) are not empty, only the first condition is fulfilled and the automation stops. In this case the weight would be updated (matching the first IF condition), but the location would not (because the first condition was fulfilled).

My workaround for this has been creating first a field that checks
IF weight AND location have values, update both,
ELIF weight has values, update weight
ELIF location has values, update location

However this does not scale very well if I want to check many fields. I would have to create a conditional statement for every possible combination. I also don't want to create separate automations for every single field - it would be neater in my opinion to have them all in one automation which would be possible if I was able to use IF -> THEN -> IF -> THEN type of logic.

The reason I want to check each field separately is that I don't want to overwrite fields that have not been updated. If the user has not made a change in weight, I don't want to overwrite the weight field of the linked record with null. This is why I need a conditional action.

7 Replies 7

This isn’t currently possible with Airtable native conditions. You could do it with a custom script or a third party automation service. 

Yannick_Burky1
5 - Automation Enthusiast
5 - Automation Enthusiast

+1

EaZyGreen
5 - Automation Enthusiast
5 - Automation Enthusiast

Yeah, I am facing the same issue here. It is a real problem, especially given that Airtable limit the amount of automations one can have per base...

Street_Team
4 - Data Explorer
4 - Data Explorer

This is a severe limitation for my workflow as well. +1 this would be a wonderful addition to airtable.

I found a way to work around this, but it's not easy and required a lot of fidling around with Copilot.

You can create scripts that run on a trigger that best suits your needs.

 

Go into Copilot AI, and ask it to write an airtable automation script that does what you need with all of your listed IFs. Remember to set the variables "recordId" in the left part of the script area and set the value to the recordId that comes from your main trigger.

 

This enabled me to go waaaay further than by using only what was available through the pre-set conditions that airtable offer.

 

Hope this helps 🙂

Hi @EaZyGreen, do you mind sharing the link of the Copilot AI you used for this? and some more details about your prompts?

EaZyGreen
5 - Automation Enthusiast
5 - Automation Enthusiast

Hey,

It's just the Microsoft copilot chat: https://copilot.microsoft.com/.

 

All you have to do is literally ask it to create your script based on your needs and test it out in your automation.

 

Helpful tip: ask Copilot to add error checks in the script so you can feed it back with accurate error returns to correct the script if it's not working properly.