+ Start a Discussion
The KnightThe Knight 

Is there a way to retrieve only custom profiles

In Apex class can we differentiate a custom profile with standard profile.

We have requirement to show the list of custom profiles only.

Please let me know how this can be achieved?

 

 

atormanatorman

Why do you want to filter out the standard profiles and only show custom ones? What is the actual use case? Do you make mass updates across *all* custom profiles or do you only assign custom profiles to active users?

 

I'm afraid the custom boolean is not exposed in sObject API. 

 

The description field is exposed. As a result, you could mass update all standard profile's description with 'standard' and then create the following SOQL in your apex:

 

select id, description from profile where description<>'standard'

 

While not ideal, it may help depending on your actual use case.

The KnightThe Knight

I want to display all the custom profiles in a drop down in VF page.

 

Yes, Custom boolean is not exposed through sObject API.

 

DML is not allowed on Profile. I cannot update from Apex class.

 

I have no Idea how I can do this.