Only first condition in actions is working

Hi Guys,
I have made a custom form with a save button. In the action i have given multiple conditions, but it’s only responding on the first condition. Is this a known problem? Or am i doing something wrong?

It’s most likely an error or misunderstanding in the way you’re applying your logic.

The way a custom action with multiple conditions works is that it will execute the first branch where the IF condition returns true, and then short-circuit (ie. none of the other branches will execute).

So if you’re finding that it only ever executes the first branch, that probably means that the first condition always returns true.

One piece of advice: I notice that you have a fairly complex if-then-else condition in the first branch, with several tests. What I usually do in cases like this is move the logic to the Glide Data Editor. So instead of complex if-then-else logic in the action, create an if-then-else column in the data editor that returns true or false/empty. Then your action condition can just be something like “if blah-blah is not true, then…”
Taking this approach makes it a lot easier to debug when things don’t work as you expect.

2 Likes

Hi Darrren,
It’s only executing the first condition on every branch

thanks for advice, i’ll try to move the conditions to data editor

I do this also. One of the main reasons is that the if/else logic in the data editor and the if/else logic in the custom actions were developed independently of each other, and so they both work differently. So for consistency, I always use the logic in the data editor when I can.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.