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

User profile in apex pages



How can I get information about the user profile (System Administrator, standard user, standard platform user) in apex code?

Best Answer chosen by Admin (Salesforce Developers) 

Hey there,


You use SOQL. For example you can get the name of the profile that the current user is assigned to by doing this...


Profile p = [SELECT Name FROM Profile WHERE Id = :Userinfo.getProfileId()];


 Just add the other fields you need from the profile to the soql select statement.