Update dates for events if they are set to recurring events and if their old dates have passed

Hi guys, I’m stuck.

I have a data base with a type of Events. some of the fields are:

  • Date
  • Recurring Frequency
  • Max Recurring Limit
  • Recurrence Count>

I want to change the date of an event when current date/time > date. And also when the event is recurring and the max recurring limit has not been reached. I have tried to do this with the normal workflows but the appropriate fields that I need to do the conditions don’t show up.

I have read up on backend workflows and I am still stuck. Please help.

I managed to set up a recurring event on the backend workflow, but it only takes a type of thing (not a list like a need). I don’t think a database trigger will work for my use case. And I couldn’t also see teh right fields I needed for my condition on API workflows.

Please point me in the right direction

No worries, I’ve managed to get it working. I used a Do Every X Seconds workflow. I used advanced filters to compare the fields I needed.

Are you doing a search every second? I hope not or you’re going to blow your WU.

1 Like

HI @ihsanzainal84 it’s every 24hrs. Is there another way I can do it. I just need a way to update the dates of recurring events if the previous date they had has passed.

I do a search with constraints on the first step, then do this on the second step for events that their recurring frequency is daily.

Are you really expecting your users to sit on your Events Page, and keep the browser tab active, for 24 hours at a time?

You can’t do this on the client-side.

You need to do it on the backend.

1 Like

You need a Recurring Event type.

Have Recurring Event on the Event type. Then when you create an event, if it’s recurring create a Recurring Event and assign this Recurring Event to all of the new events you create.

To update recurring event when it’s passed, then schedule an API workflow when
the Event is created that will run at the event’s finish time.

HI @adamhholmes I tried to use a backend workflow, but I couldn’t see “This Event”> I need it to check this condition “Recurrence Count < This Event’s Recurrence Max Limit”. The condition checks if the event has recurred the max number of times it is supposed to. Is there something that I am missing?

@georgecollier I tried to create a backend workflow, then when I tried to bring it to the frontend to trigger it, I noticed it only accepted a type of thing and not a list (mine is a list of events). So recurring event didn’t work either. Did you mean something else? Please see the attached screenshot.

Recurring Event is a data type you should create, not an action.

I mean you could also just randomly generate eventID and save it on all the relevant Events too. That might be easier actually.

That’s because you need to add Event as a parameter to the backend workflow.

You might want to start here and read about how backend workflows work: API Workflows - Bubble Docs

Thanks @georgecollier I’ll check out the docs now and see if I can get it to work. I didn’t understand what you mean by generating a random ID. Maybe I’ll understand after checking the docs.

When you create a recurring event (e.g starting tomorrow and recurring 10 times), you should actually create 11 single events. Each event should have an ID / unique string that shows they’re all related. It’s not a Bubble feature, it’s just database design.

Okay, I understand this one. I still don’t understand how to apply the ID generation to get what I want to achieve.

I’m setting up an API workflow now to see if I’ll get it right.

When you create the events, calculate random 64 character string and assign that to an eventID variable in all of the events you’re creating for the recurring event.

If you want to update a recurring event, you just search for all events in the future with eventID = This recurring event’s ID.

Ah! I think I understand now. It’s a smoother way to do the constraints? Instead of using multiple fields. Is that what you mean?

I have managed to get the API workflow to work now. What does the number in the intervals mean? Is it the time before it runs the workflow on the next record? (Eg Run for first item, wait 3 seconds, run for second item, wait three seconds, run for third item…) or is it the frequency it runs the workflow on the whole datathing?

If it’s the latter and the frequency is 24 hours. Why is it better to have it as a backend workflow vs having it as a normal workflow?

Because normal workflows only run when the workflow is triggered on a page. No normal workflows run if the user isn’t on your site.

This, just leave it blank

Oh, even “Do Every X Seconds”?

Okay.

I ran into another problem. Added these conditions in the backend workflow but records that don’t meet these conditions still get updated. I don’t know why that is happening.

You might want to start from basics to learn about backend workflows before circling back and implementing something like this which is more challenging

1 Like