Trigger a custom event from a reusable element

Hello Everyone - As far as I know, it looks like the easiest way for different reuseable elements to reference or to act on each other is by using the “Trigger a custom event from a reusable element” action.

However, for example, when I select this function in the ReuseableElement A’s workflow, it doesn’t show the custom event that’s created within ReuseableElement B’s workflow.

Capture2

Is this is a bug or am I approaching this the wrong way?

Thank you everyone.

Try using the Env variable plugin

It seems a custom event can only be triggered from the same page workflow as it is defined.

Here’s one way to get around it … altering the reusable’s custom state.

Reusable A workflow (example triggered by a button)
Reusable B has the custom event workflow
Reusable C includes Reusable A and Reusable B, it could be a page instead of another reusable.

  • Reusable A’s workflow:
    • set A’s custom state to current datetime extract milliseconds
  • Reusable B workflow “do when B’s custom state is not B’s other custom state”:
    • set B’s other custom state to B’s custom state
    • trigger B’s custom event
  • Page or Reusable C workflow “do when A’s custom state is not B’s custom state”:
    • set B’s custom state to A’s custom state

The “do when” can be set to “once only” if you only want one occurrence, or “every time”.

Another way to get around it is to set a javascript variable, as @daniel.alberttis hinted at. Any of the javascript plugins can do this.

1 Like

Check out the second demo:
https://bdkdemos.bubbleapps.io/env_variable

Can’t think of an easier way to do this :slight_smile:

2 Likes

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