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
Rabbani sayyed 8Rabbani sayyed 8 

Can any one tell me how to get profile id ?

SarfarajSarfaraj
Depends on where you need it,
Apex: Use the userinfo class. UserInfo.getProfileId() 
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm

VF: Use the $Profile global variable. {!$Profile.Id}
https://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global_profile.htm

--Akram
 
Evan KennedyEvan Kennedy
The profile Id of the logged in user? UserInfo.getProfileId(), as akram said.

If you're looking for some other profile id that isn't the id of the current user, you have to query it:

Profile p = [select Id from Profile where Name = 'System Administrator'];