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
lei.zhang@zuora.comlei.zhang@zuora.com 

Where I can find the description of Profile methods

There is a standard Object in salesforce: Profile. It has some permission methods, where I can find the description of the methods.

 

eg.

    String profileId = UserInfo.getProfileId();

    Profile curProfile = [select Id, Name from Profile Where Id =: profileId limit 1];

    curProfile.PermissionsEditReadonlyFields("maybe have parameters");

    curProfile.PermissionsManageCategories("maybe have parameters");

    curProfile........

 

    I want to find the description of PermissionsEditReadonlyFields, PermissionsManageCategories and so on.

 

Thanks.

----

Lei

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

I think there's some confusion here between the profile object available from apex and the profile object available from the web services api.

 

The Permission<PermissionName> methods are available when accessing a profile via the web services api.  When retrieving a profile via SOQL, you are dealing with a standard sobject and thus these methods won't be available.  The only permission information that you will be able to access are fields that have been retrieved via the query.

All Answers

bob_buzzardbob_buzzard

I think there's some confusion here between the profile object available from apex and the profile object available from the web services api.

 

The Permission<PermissionName> methods are available when accessing a profile via the web services api.  When retrieving a profile via SOQL, you are dealing with a standard sobject and thus these methods won't be available.  The only permission information that you will be able to access are fields that have been retrieved via the query.

This was selected as the best answer
lei.zhang@zuora.comlei.zhang@zuora.com

Thank you for you reply.

I find PermissionsEditReadonlyFields, PermissionsManageCategories and so on are fields of Profile, not methods.

Bellow works well:

public class ATest {
    public static Boolean myTest() {
        String profileId = UserInfo.getProfileId();
        Profile curProfile = [select Id, Name, PermissionsEditReadonlyFields from Profile Where Id =: profileId limit 1];
        return curProfile.PermissionsEditReadonlyFields;
    }
}

 

Thanks.

 

----

Lei