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
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