Start a custom event from the same custom event

Hi,

Quick question, can a custom event X be triggered from the same custom event X without causing any problem?
Edit: I’m seeing now that it’s not possible to do it, should i create a 2nd custom event doing the same thing (called this time X-2) ?

Yes, maybe, if you test it out and it works, I guess :man_shrugging:

Please report back what you do.



Hello, I hope this helps solve your problem.

unfortunatley (and for absolutely no good reason whatsoever) this is not possible in Bubble.

I’m seeing now that it’s not possible to do it, should i create a 2nd custom event doing the same thing (called this time X-2) ?

This is also not possible.

What is possible is to Schedule the Custom event rather than trigger it.

The officially supported way to do this is to loop 2 custom events together in the way you’ve described.

The simpler, not officially supported way (but it works, and unofficially there’s no reason to believe it will ever stop working) is to schedule the same custom event from within itself (you can only do this by copying and pasting the schedule custom event expression from somewhere else, as it won’t be selectable in the dropdown).

The only thing to bear in mind is that whilst triggering a custom even happens instantly, scheduling one has approx. 10ms delay (irrespective of what you put as the delay time).

Alright, it works, I’m triggering X-2 from X when a condition is true, and triggering X from X-2 when condition is still true. Thanks (Edit: DOESN’T WORK)

As I said above, you can’t do that in Bubble

Custom events can’t call themselves, even indirectly.

You have to do it by scheduling, not triggering.

Mhh… so through an API workflow ?

No, just by using the action ‘Schedule a custom event’ instead of ‘Trigger a custom event’.

image
I don’t see “Schedule a custom event”…

OH, I’m in backend workflows that’s why…

Yes, it’s not possible to schedule a custom event on the backend… but you don’t need to anyway, as you can run recursive workflows on the backend.

What do you mean by recursive ? Which workflows can we run recursively ?

API workflows can be run recursively - meaning they can call themselves directly.

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