You need to sign in to do that
Don't have an account?
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
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
{!$Profile.Name}
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 ] ;
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!
What's interesting about this one is that there is a "custom" column -- with the boolean field set to "true" for all custom profiles -- available in the UI when you're looking over existing profiles (https://mydomain.force.com/lightning/setup/EnhancedProfiles/home), but that data point isn't available to query against in the developer console.
Also, sadly, neither Sandeep's or Jaiwant's method returned a correct set of results in our instance, so neither method can be depended upon.
SELECT Id, Profile.Name FROM PermissionSet WHERE IsOwnedByProfile = true AND IsCustom = true
This will give us the list of all custom profile names. However if you want to get the names of custom profiles created after org creation date then you can try below piece of code:
List<Organization> dateOrg = [select CreatedDate from Organization];
DateTime dtOrgCreation = dateOrg[0].CreatedDate ;
for(Profile prof : [select id,Name from Profile where CreatedDate > :dtOrgCreation ]){
System.debug(prof);
}
select ProfileID, Profile.Name from PermissionSet where ProfileID <> null and PermissionsConvertLeads = true and (not Profile.Name like 'system%') And isCustom = true