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
Baylor PeakBaylor Peak 

query only active system admins in a specific profile

Hello all,

I am able to query all the active users in a specific profile:

select user.id, user.FirstName, user.LastName, user.profile.name, user.Username, user.IsActive FROM user, user.profile where profile.name = 'xxxxx' AND IsActive=True


That just returns the active users for the profile, but I am trying to query only the active system admins in a specific profie.

What am I doing wrong please?:)

 

$hwet@$hwet@
Hi Baylor,

This the correct query  make sure you put the name of the profile which system admin is using in your org under "profile.name"
select user.id, user.FirstName, user.LastName, user.profile.name, user.Username, user.IsActive FROM user, user.profile where profile.name = 'System Administrator' AND IsActive=True
Baylor PeakBaylor Peak

Thank you for your quick response:) Yes I did that earlier but here is where it gets tricky...

That returns all the Active Users from the 'Profile Name' but this is not what I am looking for:(

What I need is a list of the Active Syetm Admins that have access to the 'Profile Name' that I can export via data loader (hence why I need the query not not APEX).

It's been a brain bender for me and not sure this is possible but please let me know if it is:)

 

Lokesh KumarLokesh Kumar
What do you mean by active system admin? Salesforce has a System Admin profile for system admins and you can query the user as you are querying above.
Sorry, I did not get what result are you expecting.
 
Baylor PeakBaylor Peak
Ok yes, it does sound strange😅 Ok so there is a Profile named "States". Under this profile there is a list of Users containing all fifty of The United States, such as California, New York, etc. Only four of these Users are Active. Now these four Active Users have a list of Manager Hierarchical Roles all of which are System Administrators. I need to Query that specific list of System Administrators that have access to the Profile named "States". Then I want to use that Query to export that specific list of System Administrators via Data Loader. Is is Query possible please?:)
Lokesh KumarLokesh Kumar
So basically you want to query the users having Role = 'manager' and profile 'states'. 
Baylor PeakBaylor Peak

Actually, i hjad it right the first time, but it only works in Query Editor.

Here is my Query:select user.id, user.Email,user.FirstName,user.LastName,user.profile.name,user.Username,user.IsActive FROM user , user.profile WHERE profile.name = 'U.S. Soccer Partner State Associations' AND iSActive=True

I need to Query that for my Export in Data loader but it keeps retyurning 0 successes whereas in Dev Console Query ediitor it workls fine.

How can I extract this same query via Data Loader please?