Need help with custom event

I need some help with custom event.

I want to scan all users when a page is loaded and if they have’t logged in within 24 hours I want to mark a yes/no field in the db called ‘active’ set to no.

Here is what I have:

However when I try to put this as a trigger I see this:
Screen Shot 2020-05-22 at 12.09.38

It is requiring that I put a workflow thing.

I guess I am not understanding the backend workflow at all. I don’t need a workflow thing AFAIK. I just want to trigger the Custom Event I made.

Can someone please help me out here?

Thanks!

I’m not at my computer right now but what you need to do is schedule an api workflow on a list. Then search all users with that parameter and send it to your backend. The parameter for your backend api would be a user type so you can send each user to that workflow.

If that doesn’t make sense then I can probably show you screen shots in the morning tomorrow.

Hope that helps a little bit! :blush:

2 Likes

Yes I was just digging into backend workflows when I saw your message. I would appreciate it if you can share how to set this up when you get time tomorrow. I am feeling really lost right now. :upside_down_face:

Thanks!

1 Like

Here is what I have so far… am I going in the right direction?




It seems like this API Endpoint would be for an API into another APP somewhere. I see it is expecting JSON response. I haven’t made any API.

Thanks!

1 Like

I have to point this out. You should never do a backend workflow like that. I’d do it so you create the backend workflow to do it one user at a time, else it will drag your app’s performance and capacity down. Just schedule the workflow as a list instead so it goes through one each user entry separately. If you try to do it all at once it will drag everything down and slow your whole app, I tried this before and it was miserable for all my users.

1 Like

Hey, thanks a lot for your input.

TBH, I am just trying to figure out how to even do it atm. I am new to Bubble and pretty lost at the moment so grateful for your help.

I am not even clear why I need an API workflow really. I thought I could simply use an event on pageload to look at all users in lists where my timedate conditions were met, and perform an action on a field if they were like anything else. That didn’t work as I demonstrated above so that’s why I started digging into API workflow.

I also don’t understand what is happening on the backend at all. It seems to me like some kind of API that I would have to write still should be there, but I have no idea really… or is it like a cron job that this being passed to and Bubble is smart enough to figure it out?

It seems like a pretty simple thing I am trying to do but I am not sure how to do it.

So ya, if you can demonstrate me how this can be done I would appreciate it!

Thanks!

Wait a tic, I think it is starting to make sense.

The API Endpoint is actually what is on the server side maybe.

I changed it per your suggestion.


then call the whole thing as a list from a load page element whenever anyone hits the main menu

Does this look right?

I used user:first item, but does that iterate automatically? normally I would expect to have a loop there to iterate the list in a traditional programming world.

Thanks!

1 Like

Yes. This looks right!

Yes! I see events showing up in the logs now! Now it’s making sense. I just wish there was a way to run this on a daily schedule instead of when the page loads. I think if there was a lot of users it would slow the page load down.

Thanks very much for your help!!

You can schedule the workflow to run daily just do current day/time +days: 1

Ah perfect! Thank you mate! You are a lifesaver! Have a good one

2 Likes