Have you ever run into a client requirement, searched for a solution on stack exchange and to your dismay, it solely existed as an Idea in the IdeaExchange? You are not alone. I recently was involved in a Salesforce org strategy engagement where we had to split a single monolith org into several ones based on the business functions. To identify the potential applications to be moved into each org, we had to assess the user base, their permission sets, groups and queues memberships. As a starting point, we needed a Report on Users with their Profile, Role, Permission Sets, Queues and Groups.
Necessity – the mother of invention
Upon searching several articles, links and posts there was no ready-to-use solution that was admin friendly with export options available. There were tips and guides on how to get all of this data, but this involved time consuming tasks like combining multiple reports, running workbench queries, looking at individual user records etc. Armed with how quickly we can build Lightning Web Components (really makes creating UI’s super easy), I decided to create User 360 – intuitive reporting on all attributes
Drafting the Requirements
I decided to read through the IdeaExchange entry for this use case (https://trailblazer.salesforce.com/ideaView?id=08730000000glw0AAA) and identify key feature set that would be part of the User 360 component. Based on the research, listed below were the key features that I selected to implement:
- Ability to report on users and their Permission Set, Groups and Queues Assignments
- Export the List for auditing purposes
- Intuitive and Easy to view instead of complex queries
Now with these requirements in mind, I started to build the core logic for obtaining this information.
To get all the needed details around a user, let’s look at the different SObjects where that information is housed in Salesforce:
- User: Stores the details about the user like Name, Profile, Role, Email etc.
- GroupMember: Stores both public groups and queue assignments as well as individual user and nested group assignments.
- PermissionSetAssignment: Stores the permission sets assignment as well as profile
- memberships of users.
Now with the information existing on these different SObjects, it was time to tie all these together and build a wrapper Object that would feed into the User Interface. Multiple membership assignments were combined using comma separator and the search bar can seamlessly search across all those entries.
The User Interface
I decided to leverage the out of the box lightning datatable to display the results and build additional capabilities like pagination, search and export capabilities on top of it. Venky Kambham had a nice blog article on a reusable LWC with search and pagination capabilities built into it
(https://vkambham.blogspot.com/2020/02/lwc-paginator.html). With little bit of tweaks to the component, the User Interface was up and running in no time. Users can choose how many records to show in each page, search for text across any of these columns and download the results as CSV for
further analysis purposes.
The entire codebase with installation instructions is available at https://github.com/swaminathan-pv/lwc-user360.
- Leveraging existing code samples for amending the datatable capabilities helped with quick turnaround.
- The existing codebase can be easily extended to perform reporting on permission sets-based login histories analysis or perhaps even another tab in the interface to display and filter login histories.
2,570 total views, 9 views today