Reward Users an Award/Badge for Completing Tasks at Dynamic Intervals

I would like to reward my app users with badges for doing certain tasks on the app. Adding a profile photo, uploading a photo, leaving a review, redeeming an offer, etc.

I created badges in an Option Set and linked a data field in the User data type to the Option set.

Data Type: User
Data Field: user award → linked to the Option Set _User_Awards

My current set up that isn’t working:

On page load set a custom state on the Index “user_award_count” to the current user’s user_award count.

Next, I use the “Do when condition is true” action. This workflow is only triggered when Current users’ user_award:count > index’s user_award_count (users cannot lose/remove badges so the > should be fine I believe)

Screen Shot 2024-01-10 at 1.34.57 PM

I use the “Do when condition is true” to show a floating group that displays the text “You’ve earned an award” with a button they can click to see the award they have earned and scrolls to the entry in the repeating group.

It also sets the index custom state user_award_count to equal the current user’s user_award:count (this way the next time current user earns a badge the index will be 1 less than the user’s badge count so the “Do when condition is true” action should be triggered again.) and to set a second custom state on the Index which is the name of the award they just earned.

My problem is that the workflow action “Do when condition is true” is not getting triggered every time the condition changes.

It seems to trigger once per app load. For example, if a user adds a profile photo to earn one badge, and in the same session leaves a review to earn one more badge, they now have two badges but the workflow is only triggered the first time when they earned the first badge.

Does anyone have any ideas on what I might be doing wrong or suggestions for a better setup?

Essentially, I would like to award badges at dynamic intervals but I’m having trouble setting up the workflows to actually award the user when they complete a task that should give an award.

Hey, I appreciate you breaking down the problem so clearly. The simple fix to your issue is to check if the trigger event is set to run only once. You can change it to run every time.

However, any event triggered by a change is a resource drain and is not always reliable, and the way you are storing the awards, there is no log of when it was activated, etc., so you might want to reconsider how you want to store the awards for the user.

Thank you! It’s my first time using this condition in my workflow and I completely missed that the “run this” was set to just once.

I have around 40 awards so far and most are harder to complete so it wouldn’t be running super often but I do want to watch out for resource drain. That’s a really good point!

I also noticed with my current set up for some of the awards a single workflow will accrue a lot of workload units. For example, I have to “Do a search” to see what the count is every time a user uploads an image because I have a badge for 10, 25, 50, and 100 images uploaded. I assume this will eat up my workload units fairly quickly with the 200 users I have so far. Not counting the additional awards I have with similar intervals.

Would you happen to have any recommendations or ideas of a better way to store the awards and ways to trigger workflows showing the user that they have earned the award?

Thanks again!


Add to a count (or to a list) the moment that the user obtains an award. No searches involved with this approach.

Yeah, in broad strokes I’d make a dataset for Awards and either add a field for whether the user was notified of that award OR store a list of new awards for the user. Either way, on page load, check if user has any New Awards.

Awards for milestones of images uploaded: if multiple awards tied to such milestones you can store the upload COUNT on user; otherwise, it’s not too cumbersome on back end when uploading an image to see if count is 25, 50, 75 100 and then add an award (check out modulo)

IF all awards are based on client-side user actions, then simply follow @cmarchan’s post.

1 Like

Thank you both very much for your help!

Adding a counter to the User Data Type is a great idea since the majority of the awards are given based on client-side actions (leaving a review, uploading an image, adding a profile photo).

I’m trying to figure out the most efficient database structure going forward to save my workload units.

I created a new Data Type called User Awards.

Data Fields:
user > User
user_awards > List of _User_Awards - which is the option set

The User Data Type is linked to the User Awards Data Type.

When a user adds a profile photo I have a step in my workflow that looks like this:

Thing to change:

Only when:

So, I’m currently doing two searches which I don’t really want to do, but I think I have to since this thing to change below was saying that the user_award_data_type field was empty so nothing was changed in the database. I checked privacy settings and they aren’t a probably and the current user was correct.

Screen Shot 2024-01-12 at 4.22.01 PM

So, now I’m wondering if it would be a better idea to link the User Data Type to the option set directly within the User Data Type and to remove the new Data Type I just created called User Awards.

I don’t need to know when the user earns an award. I just want to be able to notify them that they did earn an award and show them what it is. Because of this, I believe I need to fill out the “only when” section in the workflow actions so that they aren’t notified every time they change their profile photo for example.

In summary, adding a count field to the data type User should work for reviews and images uploaded, but I’m not sure what would be best for the earning awards - linking the User to a data type user_awards and then to the option set of awards, or linking the user directly to the option set of awards.

For database structure and efficiency, is it better to have one line with multiple lists or to create a new line every time?

For example, one user with 10 awards on one line or 10 lines of awards all linked to the same user.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.