Skip to main content
Gaurav Agnihotri (Elevance Health) 님이 #Apex에 질문했습니다
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일 오후 9: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