I’ve struggled with this for quite some time since there didn’t seem to be any obvious way to grab the result of a scheduled backend workflow on a page, so thought I’d post the solution here for anybody else that’s struggling with this issue.
The trick here is in using the API Connector to trigger your own workflow, as opposed to using the Schedule API Workflow action:
Create backend workflow for whatever your needs are
Crucially as the last step in that workflow, add a Return Data From API action, where you define what you want to see on the page (In my case a simple string of comma delimited numbers).
Now set up a call in the API connector that triggers your own workflow with a POST (Bubble’s docs cover this process).
By referencing the action calling your API, you can see whatever was defined in your Return Data From API action on the page.
Would you be able to share a bit more detail on this method as I’m also trying to do the same.
Does that mean you don’t invoke the backend workflow with the “Schedule API Workflow” function within the workflow, and instead you invoke the backend workflow using the API Connector?
One note - I think it’s only possible to pass a text string in the API Connector call that triggers the backend workflow with a POST. So for this to work, I believe you need to pass through a unique id of the thing you are trying to pass, then Do search for… in the BE workflow to retrieve the thing. Unless anyone has a different solution for how to pass a thing from FE to BE in this type of example?
Also @Jici I noticed in a few other threads you were telling people returning data from a BE workflow was not entirely possible. So perhaps this solution is something new to consider?
Glad it’s useful! Was definitely a bit of a eureka moment for me.
Whilst it’s true that you can only pass unique ids from the API connector, you can still set the parameters on your backend workflow to explicit database types. When you make the call, bubble will interpret these correctly as the intended datatypes belonging to the ids sent.
You still can’t return data from a backend workflow, this is just one way of overcoming that missing feature. I use another method that doesn’t use the API connector to get the result of a backend workflow but it still doesn’t make a backend workflow return data.
How secure is this method? You have to expose your endpoint and also move the initial call to the front end. Is the “backend” part of the workflow still completely private?