James Derulo's

Portfolio

How to find Salesforce Profiles with No Users on it

Leave a Comment
How to find a Salesforce profile which has no user
I was asked to figure out a way where we can find out the list of the profile which do not have any assigned user, this sounds little tricky on paper but in reality, this isn't tricky at all. Here is small piece of Apex code that helps you out doing this 

If you read carefully attached are steps 

1. Query for grabbing list of all profiles
2. Query for grabbling list of all user
3. Generate a list of Profile type to collect - 'profiles with no user' 
4. Iterate to all profile - set up a flag as false

      for each profile ( if user.profileId == profile.id) - based on Salesforce schema (if user.profileId matches with original profile id)

5.  else if not - add that profile to our custom list 
6. Display list of profile 

Next PostNewer Post Previous PostOlder Post Home

0 comments:

Post a Comment