0

I am in the process of consolidating the profiles in our Org.

I want to create a view / Report that shows me all the profiles that have 5 or less users in them (including ones with no users assigned to them)

Tried using custom reports types with 'Users' but no profile option is present...

0

1 Answer 1

0

This is not possible using standard report but you can easily do this using APEX

Set<Id> ProfileId = new Set<Id>();
for(AggregateResult ar :[Select count(Id),ProfileId from User Group BY profileId])
        if(Integer.valueOf(ar.get('expr0')) > 5)
               ProfileId.add((ID)ar.get('ProfileId'));
List<profile> profileList = [Select Id from Profile WHERE ID NOT IN:ProfileId ];
System.debug(profileList);

In the ProfileList you will get name of all profile where user count is less then 5. Then you can easily display this result on Visualforce page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .