Thanks and Badges in Lightning Experience

As we all know there is a limitation with Thanks and Badges functionality in Lightning Experience. The idea has been created on Idea Exchange Platform and a part of it has been delivered by Salesforce.

In winter’19 Release, Salesforce has made the ability to Keep Members Engaged with Recognition Badges in Lightning Experience too as generally available. Also, As a pilot program, The ability to assign a badge to users in Lightning has been delivered. I have enabled it in my one of the Org and it is working in the same way as it was in classic. You will find the thanks action in the Chatter tab present at the navigation bar. You can enable the pilot program by working with your Support team, but still, Your user wants to see the badges they receive. How?

I have faced the same issue and end up with creating Aura Component to show the badges received by users.

Capture
Recognition in Lightning Experience

Let’s go through the code:

We have created the Aura Component named as BadgesGivenToMe.cmp and one apex controller called BadgesGivenToMeController.apxc.

BadgesGivenToMeController.apxc

In the below apex class, we are returning all the badges assigned to the current logged in user.

public class BadgesGivenToMeController {
   @AuraEnabled 
     public static List getAllBadgesGivenToMe(){
        List workbdg =[SELECT Definition.Name, Message, ImageUrl, Giver.Name FROM WorkBadge
                                 where RecipientId=:UserInfo.getUserId()];
        return workbdg;
     }
}

Note:- WorkBadge represents information about who the badge was given to and which badge was given. A WorkBadge record is created for each recipient of a WorkBadgeDefinition.

BadgesGivenToMe Aura Components

This Aura component has SLDS data table to show all the badges and use it on Home Page in Lightning Experience.

Find the Aura Component code on my GitHub repository:-

You can make amendments in the code and choose your desired fields to be shown on the table. The above solution will help you while migrating your traditional classic instance to Lightning Experience.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s