A Trailhead leaderboard to track your team's progress. Built using Lightning Web Components.
This app displays Trailhead users on a leaderboard table using Salesforce Lightning
Web Components. The bulk of the work happens in a scheduled Apex class that calls out to a custom
Trailhead API. This API scrapes for and pulls back profile data which is then inserted it into your Salesforce org in a custom
object named Trailblazer__c
. The page simply queries for and displays the Trailblazer__c
records.
You can deploy this using the Salesforce SFDX CLI or convert it to metadata and use the Force.com Migration Tool .
🚨 Note: The latest version of the leaderboard uses a middleware API that I've built to call directly in the Trailhead API to get Profile data. If Salesforce decides to update/change the data on the Trailhead site this could break at any time. This site must be set up as a remote site in your Salesforce org in order for callouts to work.
To add new Users to the leaderboard, you'll need to first ensure their Trailhead profile is public.
In the "About Me" section at the bottom of their profile, click the Edit icon in the top right and
check "Profile Public", then create a custom handle, if you haven't already. Now all you have to do
is enter your handle into the field on the leaderboard by clicking the button at the top right. The page will
automatically pull in the User's data and upsert a new Trailblazer__c
record for them.
You can schedule PopulateTrailblazers
to run at various intervals to update your
Trailblazer__c
by simply going to Setup > Custom Code > Apex Classes > Schedule Apex.
Give your job a name, select PopulateTrailblazers
as your Apex class, and choose a run
date/time.
Or, you can simply execute the batch manually from anonymous Apex:
Database.executeBatch(new PopulateTrailblazers());
The batch class enqueues a job for each Trailblazer__c
in your org. For each queued job, it calls out to my middleware
and updates the Trailblazer__c
record's data. 5 jobs are enqueued at a time (limit for dev orgs). After that it
schedules a new batch to run for the next five while removing the previous Trailblazer__c
from the queue until its
finished.
Add BadgesMove from Bootstrap 3 to Salesforce Lightning Design SystemTest/Mock ClassesConvert to Lightning Web Components ⚡Convert to Salesforce DX ProjectAdd a custom Trailhead APIDark modePagination / loading more.- Handle deactivating Trailblazers who go private / 404.
- Remove
Badge__c
.
This project is licensed under the MIT License - see the LICENSE.md file for details.