I have a loyalty card on my app (see image). The user gets a point for each purchase.
At the end of each month, I want to set the points back to zero.
I know I need a backend workflow to run once a month…but I’m having a hard time figuring out how to construct it.
For some reason, I’m not getting the right workflow set up.
How do you store the points?
I’m guessing you have a datatype of LoyaltyCard, with a number field of Points?
Or do you have a separate datatype for the points?
If the former is true, then all you need to do to reset the Points field on the LoyatyCard datatype is run a Workflow each month to re-set it.
You could run a separate workflow for each Loyalty card, or you could just run a single workflow that resets all loyalty cards at once (note: that may present issues with timezones depending on where you app’s users are based).
Bu tin either case it’s just a very simple workflow.
What is it you’re having trouble with?
1 Like
Now, I have a data type under user that is called points.
I have a workflow that when the user buys the product a point is added. That is all working fine.
The problem I’m having is trying to construct the workflow to delete the points…I’ve been trying to use ‘current date and time’ and calculate off that…
but it isn’t working.
Assuming you want the workflow to run at 00:00 on 1st of each month (in whatever timezone), you can kick it off by scheduling it to run on:
Current date/time rounded down to month, plus 1 month
Then just use the same expression to reschedule it.
Ok, so I would do changes to a thing which would be user…
then change points?
What would the change to points equal.
Added: I mean I would add change points…but I’m not sure what that expression would look like for the equal.
If you’re running a separate instance of the workflow for each user then, yes.
If you’re running a single workflow for all Users then you would use ‘make changes to a list of things’ (Users)
Well… presumably 0 (assuming you’re trying to reset them to 0?)
Thank you!
That’s why I love the forum.
There are very smart people like you that help so much.
1 Like