How to properly run conditioned action in API workflow

I have a backend API workflow that should change a status field based on a condition.
If the condition is true, the (data) field “status” should be changed to “option A”, and if the condition is false then the API should respond to its caller and change the “status” to “option B”.
Note that data actions run asynchronously.

My options the way I see it are:

  1. Test the condition 10 times (for every action in the workflow). The condition is a little complex so that’s not very efficient.
  2. Test the condition twice and use custom workflows for each result. But then how would I conveniently respond to the API call? Maybe the custom workflow can by itself be another API workflow but I don’t know how do compare the efficiency to option 1.
  3. Force an order with delays. I don’t have elements to change in the backend and the delay is ignored for data actions. So I think this path is impossible.
  4. Force an order with “result of step #”. To have a result for a step I need to reference (i.e., change) the thing. If I reference it unconditionally then the subsequent actions aren’t orders, even if they change things or are conditioned themselves. Otherwise if the reference step is conditioned, then the condition result might be false and in that case subsequent steps cannot use its result because it’s empty. Maybe there is a complex way to get a conditioned value in some other field while always returning the same result for the step. But I don’t know how to do that or if it is computationally more efficient than option 1.

I wonder what is the best way for this pretty generic problem.

Hey @silverishclover :wave:

So, without seeing your workflow, it is hard to answer specifically. Let me see what I can do to at least give you a few options.

In this example I show how you can do something in a workflow or using an option set. These are just two options. There are other available options as well.

Check it out:

Editor: 805testapp42 | Bubble Editor


Let me know if this helps a bit.

hi, sorry, I don’t understand how this relates to my question. I’m asking about the problem of changing data and using it while not knowing which action is earlier. I did use an option set for the data but that’s an arbitrary decision I think, I think I could have use numbers or texts to indicate a state.

I really don’t understand this question… or what the actual problem is?..

Could you give a specific example of what you’re trying to do, and what’s making it problematic?..

It’s ok. It might just be too much of an advanced method. The workflow part is what you might benefit from. But as @adamhholmes said, A specific example might help so we can give a specific answer. Try a screenshot of the part you are getting stuck at. :blush:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.