+ Start a Discussion

get Custom profile names in SOQL

Hi All,


how to get only  Custom profile name in soql query....  whic field am i use in where condition


Select p.UserType, p.UserLicenseId, p.PermissionsViewSetup, p.PermissionsManageUsers, p.PermissionsManageDataCategories, p.PermissionsManageDashboards, p.PermissionsManageCustomReportTypes, p.PermissionsManageChatterMessages,




p.Id,p.name, p.Description, p.CreatedDate, p.CreatedById From Profile p where p.PermissionsViewSetup = true





Suresh RaghuramSuresh Raghuram

you can query directly like this.


select Id, Name from Profile where name =' system Amin';


If this answers your question make this as a solution and give KUDOS.


for getting profile name in SOQL 

use as below 

[select Name from Profile ] ; 


second way if you want to get name of profile of current user without SOQL 

on VF Page



I want only custom profile names through SOQL


can u help any body...


Hi I have found this answer from some discussion on baords and facebook Salesforce community members. 


You can do this first of all you need to find CreatedDate  time of organization and then based of that time and date you can fetch profiles because Standard profile's created Date and time should be same as Organization. 


Datetime DT  = [Select id , CreatedDate from Organization ][0].CreatedDate  ; 

List<Profle>  Profiels = [select id , Name from Profile where CreatedDate = : DT ] ;

Jaiwant PasupuletiJaiwant Pasupuleti
Hi Bondicloud,

I know its been ages since this question is raised. I am hoping this would help someone who is visiting this now...
Assuming that all the profiles that are created by System Admin would be Custom profiles, you can run this query:
[ select id, name from Profile where createdby.Profile.Name = 'System Administrator' ]

This should resolve your issue! Let me know if there's anything I need to learn here!

Thank you!