Skip to main content
Gurus, 

I am trying to figure out a way to get user profile in apex script without SOQL statement.

Right now I have to use SOQL statement and its killing me.

private static final Id SYS_ADMIN_PROFILE_ID = [select ProfileId from User where Profile.Name = 'System Administrator'].ProfileId; ... If(UserInfo.getProfileId() == SYS_ADMIN_PROFILE_ID ){ /** your code **/ }

Regards, 

Gaurav

 
3 个回答
  1. 2015年10月1日 21:02
    I am able to get create a formula field that has the value of the current user profile name( $Profile.Name )on the object. However, I am not able to get the value of that field in apex script.

    I am using following script:

    String userProfile =Apexpages.currentPage().getParameters().get('Current_User_Profile__c');

    It returns Null value

    Any suggestion
0/9000