Make change to a thing everyday

Hi,

Long story short, I’m working on a voucher system.

Once the customer has purchased a voucher, they can use it to redeem a certain number of products. However, he cannot exceed a certain limit per day.

So I created a Voucher data type, basically containing the following fields:

  • Total quantity (number)
  • Daily limit (number)
  • Current daily limit (number)

Each time a customer uses their voucher (presses a button), the “Total quantity” as well as the “Current daily limit” decreases by 1.

When one of these two quantities reaches 0, the customer can no longer request for products.

I now need to update the “Current daily limit” every day.

Basically, I want to tell bubble to update all of vouchers so that their “Current daily limit” field is equal to their “Daily limit field”, and do this every day at 12 a.m.

Could someone please explain to me how to do it? I don’t quite understand how to use workflow APIs and recurring events.

Thanks a lot !

Create a backend workflow, with one action to make the relevant changes, and another action to schedule the workflow to run again the following day at 12:00am

Then, when you create the voucher, schedule the workflow to run the first time at 12:00am

2 Likes

Problem solved thanks !

2 Likes