0

All I've been able to find is the method UserInfo.getProfileId() which will only get the logged in user's profile ID. I need to get the profile of a list of users.

1 Answer 1

2

You can loop through the list and add the profile Ids to a set like this:

public static Set<Id> getProfilesFromUser(List<User> userList>){
   Set<Id> setProfileIds= new Set<Id>();
   for(User u : userList){
       setProfileIds.add(u.ProfileId);
   }
   return setProfileIds;
}

you should now have a set of all profile Ids for all the users in the initial list

1
  • Ah didn't see ProfileId as an option, thanks!
    – Josh
    Mar 29, 2019 at 21:32

You must log in to answer this question.

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