We are using an appexchange app that consists of a visualforce inline page. This visualforce page connects to a third-party API and displays some information on a record detail page. The licensing for this app is not done through the appexchange, but through the third-party API. So this app is deployed to all users although most of them will not get any functionality from it.

We have licenses for just a fraction of our users. All licensed users share the same profile. Currently all users that share that profile will see the visualforce page on the page layout, but the licensed users will see the information as intended, and unlicensed users will see a message that they need to request a license. This is obviously not going to work because everyone wants a license to this app.

Please assume that creating new profiles and page layouts for the licensed users is not an option. It will create too many headaches going forward from a maintenance perspective.

We have somewhat resolved this by removing access to all fields, visualforce, and apex belonging to this app from all profiles. Then we can add those permissions using permission sets for users that have a license to the app. Now when an unlicensed user views the page, in place of the VF page, they will see a message that says 'Content cannot be displayed: You do not have sufficient privileges to access the page: '.

This solution is almost works for us, but we would like to be able to customize that message. However, this is a standard salesforce message indicating that the user does not have permissions to view the page, so I do not believe it can be customized.

Any solution that would allow us to customize that message or better yet - completely hide the VF page or page layout section from all users would be suitable.

  • Is there any way to distinguish licensed users from unlicensed users? I mean, aside from trying to load the page and failing? Commented Aug 23, 2012 at 22:41
  • In code, we could query PermissionSetAssignment and find all users assigned to the PemissionSet. Commented Aug 23, 2012 at 22:59

2 Answers 2


I'm not sure how to change that message for your particular page, so maybe someone else will come along with a solution for that.

I know that you mentioned not being able to create new page layouts, but do you have access to the existing page layout where you could remove the Visualforce section on the page layout? If so, could you remove it and then add your own that conditionally includes it:

<apex:page standardController="YourObject" extensions="YourExtensionThatChecksForLicense">
 <apex:include pageName="theThirdPartyVfPage" rendered="{!hasLicense}"/>
  • Would this work as a VF component? Commented Aug 24, 2012 at 16:46
  • @EricNelson - When you say VF component do you really mean a section that you would drag onto the page layout in the page layout editor? Yes to that. Also you can conditionally include a component instead of a page. Just change the apex:include to: <c:compName rendered="{!hasLicense}"/>. However, if you mean could you write a component that uses apex:include, the answer is no. You cannot use apex:include in a component. However, you could have a component conditionally render another component...it's just the component (apex:component) including a page that is not supported. Commented Aug 24, 2012 at 18:41
  • Yeah I think I worded my question incorrectly, but you understood me anyway. I updated the question. I need it to be an inline VF page like you described on your answer. I tested, but I cannot save the page because the ThirdPartyControllerExtension is not visible. I think it needs to be global in order for this to work. Commented Aug 25, 2012 at 14:21

Create a sidebar component with javascript and check for string 'Content cannot be displayed: You do not have sufficient privileges to access the page:' replace it with your message.

Similar kind of ready code available here - http://www.tehnrd.com/show-and-hide-buttons-on-page-layouts/

I used this code to do lots of changes on default page layouts.

You must log in to answer this question.

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