I’m Grace, a Product Manager at Bubble. We are excited to release the ability to return data from custom events, which allows your workflows to now send multiple types of usable data between each other. We love it when you build modular apps that scale to millions of customers, and this feature will make it easier for you to do so.
How it works
Custom events are powerful ways to reuse the same logic in more than one workflow to build more modularly and efficiently.
For example, if you’re taking payments in your app, you can create a custom “authorization” event in your payment workflows that checks whether a user’s credit card can be charged. With this new feature, you can return a yes/no value for whether the user is authorized to be charged and an optional text value for an error message. Then you can use those values in a new workflow that either 1) charges the user’s credit card if they’re authorized OR 2) sends the user an “error” email if the authorization fails to remind them to resolve the issue.
Using this feature, you can:
Reduce the number of custom events in your app: Use a single event to return different values, instead of multiple custom events with slight variations
Build more modularly and resourcefully: Edit reusable custom events in one place, rather than multiple
Understand your app better: View one custom event, rather than multiple custom events with slight variations
This also means that your reusable elements can now hold global functions! We’re not stopping here. This new upgrade to custom events allows your workflows to act even more similar to traditional programming “functions,” laying the groundwork for even more ways to make Bubble on par with custom code.
Read more on how to use returning data from custom events in our manual.
wOW !! As I posted the “Return data from API internally” idea (in november 2020 in France we say “mieux vaut tard que jamais” (better late than never) I just get notified by email, and didn’t believe it until I read the post! Can’t wait to integrate it !! Nice news @grace.hong
[EDIT] not expected behavior lol. need to “schedule an API workflow” in front and be able to use “Result of step xx” response in front…
Returning data is amazing but my post was about being able to set up a workflow to run on some event being ‘posted’ by a reusable (without using hacky workarounds like listening to a custom state being changed). We still need this
Top work on this release though and keep em coming!
@grace.hong any chance there will be a new Workflow trigger event introduced that would be something akin to ‘custom event returned data’ (the returned being past tense as in completed), which will allow us to not only use the returned data in the same workflow, but in another workflow that is created via this concept of a workflow trigger event of ‘custom event returned data’. Similar to how there are in many plugins a workflow trigger event for when some kind of processing of data has completed.
I was also very excited when the email notify that your idea was shipped, but then after checking, it was not it. I think the Bubble team doesn’t understand your idea.
What @Sarah_Esteve meant in the idea was for a way to use the return value of API workflow when you run that API workflow inside the application.
This new feature only applies to Custom Events, not API workflow (yet?)
To be honest, the idea is not implemented, but very close. If we can have a way to: on the Frontend, trigger Custom Event on the Backend, we will get what we came for.
Yup, that was what I used.
Also my friend found out another trick, which is to use App Connector Plugin to connect the app to itself. This way you don’t even need to initialize the API call.
Would be nice if there is some official way to do it though.
In the op it mentions you can now have global functions via custom workflows in re useable elements. However in the manual it says the trigger custom event from a RE is only one way.