Reusing the same workflow

Hi there,
I have a workflow set up which handles whether a user can access certain pages or not.

I want to use use the same workflow on multiple pages without creating the same workflow in every page. Is this possible?

Thank you :slight_smile:

You can with a reusable element.

1 Like

It is a workflow saying if the contact is type A show the page and if the contact is Type B show another page.
This logic will be used for multiple pages.

You could also use a recurring event or backend workflow

Thank you. I think I came across backend workflows but couldn’t figure it out couple of months ago. I should revisit then

What you do is use the page on which you’ve built that feature as a template. When you create a new page, you use that template page as the page to clone from. Now your new page has those features.

(BTW, no previous reply is helpful.)

Thank you Keith.

But the pages were build already :slight_smile:

And your suggestion is a good hack but not exactly what I’m after for.

Basically I wonder if we can define a function (workflow) in 1 place and call the function from other places .(pageS)

No, you cannot.

The closest you can come to this is the “reusable element” concept, which is not what you’re looking for.

(The reason being is that Bubble builds web pages. It’s not a framework like React is a framework. Anything you use in a page must exist in the page. There’s no “calling” things from another page. Nothing exists outside of the current page.)

This is easy. Create backend workflow to do what you want. Then on each page set a workflow event for on page load and trigger that backend workflow event. Easiest, and actually does work.

1 Like

@keith, could he not use an RE solely with a custom event and then call the RE’s custom event from whatever page he wants?

Yes, I also see no reason why the BEWF wouldn’t work.

1 Like

There is no reason it wouldn’t work. Backend workflows are in my mind basically a reusable workflow…no need to create a reusable element just for a single workflow.

1 Like

@SerPounce @boston85719 @keith Thank you all.
Time for me to work on :slight_smile:

1 Like

Yes, this is a backend workflow. Build a workflow in backend workflows and then in other places call it by doing a workflow event in another location to ‘trigger a backend workflow’

Well, no, it’s not what the OP is asking for. OP wants for there to be a context object that persists across pages. There is no such thing in Bubble. (Because the pages are “REAL” pages.)

The only thing you’ll need to ensure is that the data a all good to go because there is no Visual Error handling.