0

I have a custom permission in my Managed Package. I use it in my Visualforce page to allow certain features for users that have this permission.

<apex:commandButton value="Register Connection"
  action="{! registerAppConnection }"
  disabled="{! NOT($Permission.Manage_App_Connection) }"/>

But when I open the Visualforce page in my testing org, where I installed the package, I see the following error:

Field Manage_App_Connection does not exist. Check spelling Error is in expression '{!NOT($Permission.Manage_App_Connection)}' in component in page mynamespace:settings

I checked the CustomPermission object and verified that this permission exists.

However, it works well in my dev org. I cannot figure out what is wrong.

Update

CustomPermission.obj

enter image description here

SetupEntityAccess.obj

enter image description here

As you can see it's in my testing org and names are correct. Why my visualforce page doesn't recognize $Permission.Manage_App_Connection is still a mystery to me.

1
  • Cross verify these two points in your testing org:- To determine which users have access to a specific custom permission, use Salesforce Object Query Language (SOQL) with the SetupEntityAccess and CustomPermission sObjects. To determine what custom permissions users have when they authenticate in a connected app, reference the user's Identity URL, which Salesforce provides along with the access token for the connected app. Also check api name. Aug 8 '18 at 1:42
0

Example

To have a pageblock only appear for users that have the custom permission seeExecutiveData, use the following.

< apex:pageBlock rendered="{!$Permission.canSeeExecutiveData}">

$Permission appears only if custom permissions have been created in your organization. For more information, see “Custom Permissions” in the Salesforce help.

May be you have custom persmission in managed package that's why you are not able to do. Try to create it in your testing org and test the page weather it is rendering or not.

Reference:-

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_permission.htm

Not the answer you're looking for? Browse other questions tagged or ask your own question.