function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ethan huntethan hunt 

soql for roles

Hi ,

I needed a query which can retrieve users names which has no roles assigned to it.

Please help..


Regards”
OviOvi
List<User> users = [SELECT Username FROM User where UserRoleId = null];
ethan huntethan hunt
Thanx Ovi.

I need a little more help. I need a query which will fetch teh following -

1. Pagelayout which are not assigned to profiles and record types.
2. Users which are haing more than one profile.

Regards
OviOvi
1. I dont think you can get this by a query
2. Users can only have one profile
Vinita_SFDCVinita_SFDC
Hello,

1. You can not query on page layouts.
2. Users can have only one profiel but can ave more than one permission set.
ethan huntethan hunt
Hi All,

Thank you all for your suggestion.

@Vinita - Can we query , a user is having how many permision sets.

Regards
Vinita_SFDCVinita_SFDC
Hello,

Yes it is poosible. Use the PermissionSetAssignment object to query permission set assignments to find out which permission sets are assigned to which users. For sample queries refer following document:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_permissionsetassignment.htm