[New Feature] Scheduling API workflows can now be done recursively

It is a “Do … While” loop. Where the “While” is able to be dynamic i.e. you don’t need to know the answer before you start.

Example : Update all the users who have not been active for 7 days …

Previously you would have to generate the “list of users” in advance.

Now you can loop the API workflow while there are still users to process. Although it may be that this is still better done by “schedule on a list”.

Example : Create a thing for each month in a year.

Previously you would have to generate a list of 12 numbers or months, and do a workflow on this list.

Now you can “Do … while there are less than 12 months created”.

A more complex use case is one where you are doing some processing within the loop that might be difficult to work out in advance.

So say you want to add up invoice items until the total is > £500 and then create something.

Now you can loop while the total is < £500.

Obviously this allows you to … “Do … While black = white” so loop forever.

11 Likes

Thanks @NigelG just needed an old school explanation :smiley: Now I know what it is this is awesome!

Thank you very much for that awesome update!

Hi @josh, nice explanation.

Can you clarify, does the scheduled workflow wait for all remaining steps of the current workflow to complete, as well as its scheduled date? Is this only for recursive workflows?

Definitely one of the best updates recently!

1 Like

This is great – thanks!

Awesome - Big addition - Thanks to the development team!

Thank you !

Stupid question, but once set up I gather we still have to initiate the API endpoint with an event - such as tick a box. There is no way to activate the API from the ADMIN?

Update answer to my question is NO admin, but works great when implemented using front end. The use case here was to run an API workflow to update a records in a growing database.

1 Like

Am I interpreting this correctly that this allows you to override restrictions on monthly/weekly/daily schedules that have been in place for the different Bubble price levels?

I.e. run a daily update of something by re-scheduling every 24 hrs?

6 Likes

Good question. I’m interested in knowing this too.

5 Likes

@josh

Could you please help us here?

What are the limits on scheduling workflows recursively?

Could I set a 24-hour loop-like check flow which would trigger on-list flows?

It’s great to see the confidence to lift this restriction! Really nice feature.

I was wondering if there any potential downsides to running a recursive workflow idle. For example in your example, what if you remove the condition on rescheduling the workflow. Will it use any server capacity if the list to run on is empty?

Aaaawesome! :slight_smile: Could this be used to e.g. trigger a workflow every hour? So I trigger manually the first one and that one is going to trigger itself every 1 hour. For checks, this would be awesome, guys.

1 Like

I am still having a hard time implementing this into my application. Does anyone have any videos that explain how this works in simple English?

I want to make sure I’m not creating a loop that crashes my app or anything like that, or worse, something that deletes things that are not supposed to be deleted.

All I want to do is, when the user “deletes” something, that I will make a text field that says “Delete” which hides it immediately from their list.

Then on a monthly basis, because that’s all I’m allowed to do on my plan, go through and delete all the things marked “Delete”.

Can anyone do a mock set up or possibly a video explaining how to do this properly? I really want to set this up in my app to speed things up but want to do it correctly.

Thanks for any help in advance. :slight_smile:

When you user deletes a thing, you write “DETETE” in a field.

Create an API flow to do the following (call it DELETE THINGS):

Action 1. Delete a list of things on the list: Find records which contain DELETE.

Action 2. Schedule API called DELETE, and put schedule time as Current Date + 1 day.

Then you need to go on any page and create a button and attached the following action to it:

Schedule API called DELETE, and put schedule time as Current Date.

The above will basically start a loop which will go around every day and delete things that a marked as DELETE.

You will have to trigger/schedule first round manually in both Test and Live Version.

3 Likes

Thank you! So basically I need to make an admin page to put a button on to start it? Is there a way to stop it with a button from an admin page too? Also, when normally is a good time to run these? People use my program from around the world. Maybe I can do a notification while it is processing somehow to let them know it might be slow at the moment?

Why do it in bulk? When user “deletes” something, update your flag and schedule an api workflow to delete the thing with a start tine of current date/time + whatever your interval is.

If you wanna be really cool, set a date field on the object that represents that expiry time. Then you could easily see how much time the thing will continue to be in the dB.

1 Like

The above seems to be a good way too.

To answer your question, instead of You could create “on load page” action which would create trigger a thing and write down scheduled api flow id , then when this api flow is run and scheduled itself again change this thing to record new api flow id. This way you will have current id written down. Otherwise you can see all scheduled flows in Scheduler section in settings.

But I think you should try the above method: when a thing gets deteled by a used, mark it as deleted and schedule deleting api straight away. This way the load would be more evenly distributed.

Finally, I personally don’t see a need to delete thugs permanently, just hide it :slight_smile:

Hmm. All good points. Does having so much in the database slow the app down eventually. Like if it has to search through so much more data then it would eventually slow down right? I just thought maybe it was good dev standard to delete a clean up your database. I’m a newbie though. What would I know. Haha.