0

I've selectively granted access to a Visualforce page embedded in a record detail page for only specific users. I used a permission set to achieve this. Now that I can selectively grant permission to the page and fields involved, I'm having to see a big warning about not being able to access the Visualforce page for users not given the permission set. Error Displayed

If possible, I would like this warning to not be displayed so that the users who don't have permission to use the feature don't even know that it's hidden from them. How might this be achieved?

5
  • Is this for classic or lightning? Commented Dec 17, 2020 at 19:48
  • @DrewKennedy Classic. Lemme update in the tags.
    – Tim Hunter
    Commented Dec 17, 2020 at 19:56
  • You may be in trouble then as page layouts themselves don't offer much flexibility. Another page layout may be an option if who you're selectively granting access to represents a full profile. Another possible option is checking in an apex controller if they have access and if not doing a "display:hidden" css rule on the page. Commented Dec 17, 2020 at 20:03
  • @DrewKennedy Yeah, figures it wouldn't be a simple fix... This is meant to just limit for a test pilot group for a week or two until the feature is made accessible to the entire profile. Not sure it's worth looking into making another profile/page-layout or adding the check to the controller. I will keep them under consideration though in case the client decides it is worth it. Thank you for the ideas.
    – Tim Hunter
    Commented Dec 17, 2020 at 20:08
  • 1
    Agreed, it's not worth it. No sense in throwing custom technology at Salesforce's native behavior that's working just fine. Commented Dec 17, 2020 at 20:09

1 Answer 1

2

You could make the VF page accessible to all, but create a Custom Permission. Assign the Custom Permission in the Permission Set which is assigned to users who should see the VF page.

Then, in your VF page, render the full VF page for users who have the Custom Permission, and render a blank page, or some friendly boilerplate to those users who do not have the Custom Permission.

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

You must log in to answer this question.

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