I really like how easy it is to copy/paste actions, but I think one way to make it better would is by have a way to mark certain actions as reusable and have them show up in some type of dialog/popup so you could easily search and pick them across events and workflow.
Thatâs what custom events are for. Explore
But an event is attached to a specific element (e.g. button 1), correct? I want to be able to be on a different workflow and attach a previously created action on a different element (e.g. button 2).
Also I havenât figured out how to save an event as a custom event. My custom event popup is empty.
"Create a custom eventâŚ
Bubble lets you create some custom workflows, so that you can reuse the same logic in more than one workflow. This event lets you define such a workflow. You give a name to the workflow, then youâll be able to use a âTrigger a custom eventâ action to run this workflow from another workflow. You can think about this feature as âfunctionsâ in Bubble.
Event name
Type here how to name the workflow. Youâll be able to select your custom workflows in the âTrigger a custom eventâ action by its name.
Type of workflow thing
If you want the custom workflow to be able to take a thing (entry from the database) as an argument, define the type of this thing here. If this field is set, the âTrigger a custom eventâ action will prompt you to define which thing should be sent when running this workflow.
"
Not exactly straight-forward to define such events at some page when theyâre reusable - can they talk to that page from another page? if not they should either be shown at different section in the workflows (say the bottom half part hold those reusable events and the top hold the page specific ones), or as I had suggested at other post make a page thatâs called âApplicationâ to hold events (and maybe UI parts that show up in all pages, like say a common header [like a template that is])
How do I name a workflow?
Now that I got how the work, found a use for the custom events. In the workflow shown in the screenshot, at change of each StarRating elementâs value I want to calculate the average score and put in the DB for later reuse (since itâs hard to calculate complex formulas with no parentheses I can calculate their parts gradually and keep them)
From description in reference I thought you could reuse them at other pages, but I guess theyâre per-page only (can call those functions from other events. As I wrote above, it would be nice to have an Application page too to host Data-related workflows (do stuff when data changes) where you could probably also define global functions visible by all pages (since those will be able to access only data and global UI defined at that page [that UI would be like a template, repeated at each page, so flows that use those names would work everywhere])
I really donât understand whatâs the difference between âtrigger a custom eventâ and âtrigger a custom event when data changesâ since they both take no parameter. Plus this is an action, what does it mean âwhen data changesâ? Does it pause and wait for something? Or does it skip execution if no data changed? What data?
btw the âtrigger a custom event from a reusable elementâ mean you CAN have global functions (custom events) and reuse them at any page, you need to place the reusable element in the page though, since that custom event may be doing stuff with the controls in the reusable element too (wouldnât want its actions to break)
It allows you to do something when a âwatchedâ data item has changed. So maybe a message has been received, or a bid placed etc etc
So the data changing in one users screens (clicking bid) causes an action in another userâs screen (âBid received pop upâ).
So in effect a listener.
Found where to go to create custom events. Itâs only under the âClick here to add an eventâ on the Workflow page
where do you select the watched item?
Create the Custom Workflow.
Then under the action, you have âŚ
You select the âthingâ to watch, and the field on that thing, in the parameters.
when the event has no param and I add this action it has no option on what field to watch for. Thus user doesnât understand how it works differently. Also not sure what it does even when I have a param at the event. Does it freeze at that point of execution till some data changes?
aha, shown as an issue if you havenât selected an event that has param, hadnât noticed. If that action with the issue had a red box I would have noticed
Make sure you trigger the âlistenerâ workflow on something.
And that the data is set AFTER the listener is triggered.
So you canât set it on page load and then set the workflow thing it is watching. You need to have the thing, and then trigger the wait.
could you provide a sample case scenario and screenshot?
Will look at doing it at some point.