A tip or a JS plugin to trigger my app's existing "Custom Event" by specifying a dynamic event name?

Hello,

I was wondering if there was a plugin or a way in Javascript to be able to directly trigger a “Custom Event” with a dynamic name instead of having to choose the name from the list.

My app is quite complex and particular, but basically the idea is this:

  • An AI gives me a list in text format of “Bubble Custom Events” to trigger, for example: EventToTrigger = ‘CheckGmail’, ‘CheckHotmail’, ‘CheckLive’"

  • To gain performance I want to trigger all the elements of this list in parallel and therefore “schedule” the “Custom Events” which correspond to the names of my list. But since it is impossible to put a variable in the name of the Custom Event to trigger, I am currently forced to do a huge workflow which tests all the possibilities: if EventToTrigger = ‘CheckGmail’ => Call ‘CheckGmail’, If EventToTrigger = ‘CheckHotmail’ => Call ‘CheckHotmail’ etc. Whereas by passing the name dynamically I could directly call the correct Custom Event without multiplying these “if”… knowing that there are more than 80 possible functions ;(

This is obviously not natively possible in Bubble and I’m looking for a tip, in case someone has an idea…

Thank you :kissing_closed_eyes:

dynamically triggering custom events by name isn’t directly supported in Bubble.there isn’t a dedicated plugin for dynamic event triggering

image

Yes, you can create a plugin and use javascript to do the if conditions, then trigger the event in the plugin. The event can then trigger your custom event. This is possible using a plugin element meaning it has to run client side and not in the Backend Workflows.

1 Like

Use the Toolbox plugin. It has exactly what you need with it’s JavaScript to Bubble element.

1 Like

Thank you for your response, I created a plugin but obviously it does not seem possible to trigger an event existing in the Bubble app from a plugin, it is limited only to triggering events that exist INSIDE the plugin. I am wrong ?

Why are you creating a plugin when one, that’s also free, actively updated and with thousands of downloads, already exists and does exactly what you’re asking.

Unfortunately Toolbox plugin is not doing what I’m looking for, my goal is to trigger an existing “workflow custom event” by using a dynamic name. For example in this image I like to set “SearchAndShowImages” as a dynamic value.

Toolbox’s JavaScript to Bubble element has an event that let’s you define actions just like you would a custom event.

Read the documentation here:
https://toolboxdocs.netlify.app/js2bubble#js2b

2 Likes

Ok I finally got it, thank you for your help ! So I need to create one JsToBubble element per “function” but it’s fine.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.