[How To] Update balance every month from the day subscription starts

How to do this: Update balance every month from the day subscription starts

Update users balance with the ammount that corresponds to users role (subscription plan)

Recursive WF that updates the balance and reschedules itself to launch in a month?

ye however 1 user may take the subscription on 15/01 and another on 01/01,
Do you know anything that could work for that ?

So you just need to take the date of subscription and add +(month) 1 to get the scheduling date of next WF run. Here is an example with a date/time picker (just to store some date) and text field that uses expression I mentioned above:
Screenshot 2023-06-06 at 13.26.33

okay, and where do i need to set this WF, imagine i have 100 users, how will it handle all ? could you make a basic example, cuz i don’t know what recursive WF are

Recursive Workflows are another name for “For Loop” as a broader programming term. You can create a recursive workflow in the “backend workflow” section. It can be accessed from your bubble panel( the same place you can access your pages and reusable elements).
I suggest checking your app’s logs to find out the period in which your app uses the least WUs. Create a recursive workflow to run during that period.

i will set a recurring workflow in backend, however i’m currently testing when i click on a button however its not making any changes, would you maybe know what’s going wrong, (syntax maybe?)

i don’t think the error is in the Only When, because i removed it and it’s still not working :thinking:

Let’s test it without the “Only when” condition.
Click the button to trigger the “Balance Update” API workflow.
Go to Logs/Scheduler. Enter the appropriate date and time in the “Show workflows scheduled after” field and hit “show”.
What do you see?

Also, you can use this to check one month after the current date:
:user's:item #index's subscription_start+(months):1 equals rounded down to month current date/time

Ok so when defining the user, i don’t know how to set a condition in the search for user’s to only have subscription_start+(month):1 = current date/time:formatted as 09/06/23

Please check the data type of “subscription_start”. It should be “date”.
If “subscription_start” is of “date” data type then you don’t need to use “:formatted as 09/06/23”.
":formatted as " converts the date into the text of your chosen format.

do you know any method to get the month to be minus ?

you can just type it manually +(months): -1 for example

1 Like