public static void sendEMail() {
List<User> userList=new List<User>([select id,ProfileId from user where isActive=true]);
set<Id> userId=new set<Id>();
for(User ur:userList){
userId.add(ur.ProfileId);
}
List<Profile> profileList=new List<Profile>([Select Id,Name From Profile where id in: userId]);
}
'Manage Users' permission allows Create/Edit Internal User and have access to all User fields. Please read details in below docs
reference:
https://help.salesforce.com/articleView?id=000324398&type=1&mode=1
https://salesforce.stackexchange.com/questions/207789/who-can-create-the-users-in-salesforce
If it helps mark it as best answer.
Thanks!
Hi,
You can query like this to find the user related to specific profile
and for modified by
and created by
Please mark it as the Best Answer so that other people would take references from it.
Thank You
Hi,
You can take references from the below code.
Please mark it as The Best Answer.
Thank You