I'm trying to check the User assigned Custom Permission from a Managed Package. The Custom Permission and the Permission Set are not part of the package, but in the subscribers Org.

Currently I'm trying to use the FeatureManagement.checkPermission(), but seems that the package can't access to the Custom Permission record. The call inside the package returns False, when instead made from out of package (execute anonymous) the return value is True.

To be clearer, an example of code I'm running:

//execute anonymous
System.debug(NS.MyClass.customPermissionMethod('myCustomPermission')); //return false
System.debug(FeatureManagement.checkPermission('myCustomPermission')); //return true

//Managed Package Class    
global class MyClass {
    global static boolean customPermissionMethod(value) {
        return FeatureManagement.checkPermission(value);

I have not found anything on the documentation that spoke of this specific case, has it ever happened to you?

  • 1
    I think that sounds right Andrea, because FeatureManagement seems to be built to check Custom Permission owned by a given Managed Package: developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/… Nov 27, 2019 at 10:50
  • Thanks Jeferson! It will be the case, however, there is no reference to the package in the "FeatureManagement Class" documentation link. The methods performed outside the package work without particular constraints
    – Andrea P.
    Nov 27, 2019 at 13:33
  • Yes, you are correct as well Andrea, I think it might be worth to open a case then. Nov 27, 2019 at 14:20
  • Yes, we'll contact the SF Support!
    – Andrea P.
    Nov 28, 2019 at 8:42

1 Answer 1


Salesforce support told us that this is an error in the documentation, which they will correct. The "checkPermission" method inside a managed package will only be able to verify the custom permissions of the package itself. To get around this, you need to implement the "workaround" solution with 2 queries.

I don't fully agree with this choice/answer, but that's it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .