Backend workflow - Update a Data Field of all users

Hi everyone.

I have a Data Field on the user Data Type that is called ‘TotalTextSMS’. By default this Number field is 300. And when it hits ‘0’. People can no longer send SMS Texts.

However, I want a Backend Api that automatically resets/changes every month that Data Field of EVERY user to 300 again.

So basically, everyone can send 300 SMS Texts per month.

Does anyone know how I set this up? I have no idea how to take it from here.

Hey @oliviercoolen,

You can do this with Recurring Events, which you define in the BackEnd workflows interface.
There are two steps:

  1. Create a recurring event, taking the current user, and setting the SMS count to 300 (screenshot 1 & 2)
  2. When user registers, in your registration workflow, you schedule the recurring event by using “Set/cancel a recurring event” (screenshot 3).

One thing I initially had a hard time wrapping my head around is that you create Recurring Events (RE) sort of as templates: you don’t define the frequency and the data when you define the RE, you only specify what kind of Thing the event will take, and the actions. You do the actual scheduling of the RE by using another workflow action. In this example, you schedule the RE when the user signs up.

You can see your scheduled events in the Logs → Scheduler tab, which is super helpful when you’re building these out.

Hope this helps! :rocket:

Thank you very much @launchable ! You’re a life saver. :smiley:

By the way, Start date now equals Current date/time. Any way that we can set it up so it changes every first day of the month? :slight_smile:

Glad it helped :slight_smile:

The following expression might do what you’re looking for:

date_statement

This sets the time to the next month, day 1. So replace the “Current date/time” value with this expression, and it should work.

Cheers

1 Like

@launchable hoho thank you very much! This is exactly what I’m looking for. :smile:

2 Likes

Just used this and it’s still working perfectly.

Thanks.