How to use custom events?

Hey, one thing I’ve noticed for a while now is that there is an option to trigger a custom event at the bottom of the workflow categories. What exactly is a custom event and how do you create one?

Custom events are a way to define some workflows that can be run in more than one place in your page (for the more tech-sensitive people, they are quite similar to functions). So the way it works is:

  1. you define such a custom event, and the build your workflow, action by action. You can specify a type of content for your custom workflow, and they have these actions modify it.

  2. then, in some other, traditional workflows, you can pick the ‘trigger a custom workflow action’ and pick which workflow should get run (and specify which data you want to send to it, if any).

5 Likes

@emmanuel

Are there more detailed instructions somewhere on how to create a custom event? Where are these built? Is there an example?

Thanks!

You will find the ability to create custom events in the workflow tab. After you create a custom event, add it as an action in another workflow.

1 Like

@Scott That clears it up! Thanks a bunch

1 Like

Hi

Is it possible to haven multiple custom workflows that listen to a single event ? but are triggered only when their specific conditions are met ?

For instance different behavior depending on whether the user is logged or not.

Many thanks

If you put more than one trigger action in the same workflow that should do it no?

1 Like

Yes, agreed.

This is probably not the most maintainable event driven approach. For every calling workflow it is needed to have n triggers, one by ‘listener’, and when a listener is added, m triggers have to be added, one by calling workflow.

But this is very fine. Thanks a lot for the clarification, it will save trial and errors.

Cheers

What data can be sent to custom events? Could some provide an example of how to do so? Thanks!

For reoccurring processes: using custom events are basically page-defined javascript functions and using the API workflow page is like calling a function from a library/external js file (ex. user_defined_functions.js)?

Seems like you might use custom events for reoccurring processes you’ll never use outside of a specific page, and the API workflows for reoccurring processes you may use again outside of a particular page. Minimizing repetition/redundancy is always a good idea. I don’t see a limit on what data can be sent to/from custom events…its not an API endpoint, so you obviously can’t use it like one…it’s just an easier way to reuse logic on the page.

1 Like

Hi there, is it possible to define input variables for a custom event?