Query for Users with License

Query for Users with Salesforce License

  1. Map<Id,Profile> profileIds = new Map<id,profile>([SELECT Id,UserLicenseId FROM Profile where UserLicenseId  in (SELECT Id FROM UserLicense where name ='Salesforce')]);
  2. List<user> standardProfileUsers = [select Name from user where profileId in:profileIds.Keyset()];
  3. System.Debug(standardProfileUsers);


Comments

Popular posts