Reusable Create Patterns that Return Things

Hello Intrepid Bubblers.

I need to create an item of data, and there are several related, complex steps involved, and I need to create that data from several different points in my app (such as via an API or from a user interface event) and, most importantly, I need to return the newly-create data item to those client workflows so I can act on it.

My choices seem to be …

  1. Recreate the complex create logic steps in each different place I need it to happen
  2. Do it in an API Workflow, which sounds groovy, except that workflows don’t return anything back to other workflows, unless you hook them up to the API Connector

I’ve used method #2 before but it seems a little screwball - exposing something externally only so it can return a parameter to an internal workflow. And I’m not sure it’s the best option for performance.

Option #1 is not exciting from a maintainability standpoint because now I have two or more touch points for that complex creation logic - a lot of places to make changes and easy to get out of sync.

Does anyone have any other ideas here? Am I talking Esperanto to myself?

Brendan

Whenever you call an API workflow, save (create) the data you need in a log identified by its ‘unique_id’ so you can read this information at the right time. It’s an indirect ‘return back’.

That’s a great suggestion.

With several potential users creating data, I think it could get tricky to make sure to always grab from the log the last un-grabbed item for the user - and then update the log to indicate it’s been grabbed.

Still a bit of a long way to go to just return a value. It’s a very Bubble-ish workaround - write a value to a table for something that, well, you might have thought you could handle programmatically.

(Which is also how you often need to solve for the fact that calculations don’t do parenthesis. Although there are plugins.)

The magic of API Workflow (run on server side) make your app faster for your user (but make our life a little bit tricky :slight_smile: )