Forum Academy Marketplace Showcase Pricing Features

Reusable condition like custom events and reusable elements

One of the things that makes products difficult to scale is maintenance.

Custom events and reusable elements are by nature reusable, and I am wondering if Bubble team can implement ‘reusable condition’ feature.

Of course, we can do copy and paste conditions, but often times business logic changes and it becomes difficult to manage where I’ve set those specific conditions (that could be in elements on pages, elements on pages, workflow events, subsequent actions, events, etc.)

For instance,

  • [Search for a thing: constraint 1] is used in 3 text elements, 1 button, 2 groups, 1 workflow event and 3 actions.
  • You designed those logics 3 months ago
  • After user feedback, you realized [Search for a thing: constraint 2] would work better.

This is where bugs occur… You thought you’ve made all changes but in fact, you missed one part. Instead we could do:

  • Set [Reusable condition A] (that should always result in yes or no)
  • Make all those 3 text elements, 1 button, 2 groups, 1 workflow event and 3 actions follow this logic [if Reusable condition A is yes]
  • When business logic changes, you can simply change [Reusable condition A]'s logic and the elements that rely on that condition will be work as expected.

Would this feature be viable?


I would be interested to hear how people deal with this scenario.
I’ve re designed many things in my app many times as I learn better ways to do things and often it can mean hours of finding bugs and finding every place that “search for constraint 1 was used”
I’ve even started over from the start once.

1 Like

It seems that this need would be satisfied if Bubble gave the ability to write functions. A function, returning a true/false result, could then be used to evaluate a constraint. And when the rules change, only the function would need to be changed.

This is essentially what I think you’re asking for, but functions could be used in so many other ways, such as doing complex calculations with a single numeric result.

Hi Ernie,
This scenario is exactly the one that brings me struggle right now…
I am interessed to hear what solution you implemented after all (if you find something)

For future readers. The following might not be as global to the app as a reusable element, but it does the job on a page level.

The canvas framework by Airdev uses a popup (usually named hidden variables popup) which contains groups and repeating groups that store the “global” variables of the current page. In this popup, you could have groups that are of type needed (eg boolean, option set, etc) and then, reference them in your appearance conditional logic, workflows, etc. All in one place, which makes it a bit easier ti maintain.

Maybe you can combine this idea with a “app variables” type of thing to really make it global.

I really recommend taking a look to Airdev’s Canvas App Template. It is filled with quite smart workarounds. Also, take a look to the Canvas Manual Best Practices section.