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.
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.
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.
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.
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!
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.
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.