Grouping and Ranking of Badges

You can define badge groups, the rank of the group and the rank of badges within the group. This enables sorting customers' badge collections and highlighting their achievements.

For example, in the below screenshot, Limited Edition badges have a higher priority followed by Monthly challenge badges, Workout badges, and Close your Rings badges. Within each defined group, badges are sorted based on their rank.

Example

Consider three badge groups, Group 1, Group 2 and Group 3 ranked 1, 2, and 3. While creating badges, Badge 1 is tagged with Group 1, Badge 2 is tagged with Group 2, and Badge 3 doesn't have any group tagged but has a badge rank of 1.

Retrieving badges list

In the above scenario, when you retrieve the list of badges available for a customer, the system prioritizes based on the defined groups and badge ranks. Initially, the list is ordered as Badge 1, then Badge 2, and finally Badge 3 (due to the group tag of Badge 3 being null but having a rank).

Impact on deleting a group

If a group is deleted the order of the badges also changes. For example, if Group 1 is deleted, fetching the badge list will now prioritize Badge 2 first (as it belongs to Group 2), then Badge 3 (due to its rank), and finally Badge 1.

The sorting of the badges is performed using the sortOn parameter in the Get customer badge API.

Sorting logic:

  • Preference will be given to the groups as per their ranking
  • Within the group, preference will be given to the badges for which badge rank is defined, the rest of the badges with no badge rank will be sorted in default descending order of expired date
  • If badges with no group are defined, they will be sorted in order of badge rank (if defined), followed by default descending order of expired date

Notes

  • Group name must be unique within the active groups in an org
  • Group rank is mandatory but there is no uniqueness on group rank
  • Badge rank is non-mandatory
  • Groups can be disabled by making the isActive flag false

Refer to the API documentation below:

Create Group

Update Group

Get Group by ID

Get all Groups

Create badges with Group and Badge Rank

Update badges with Group and Badge Rank