You need to sign in to do that
Don't have an account?
Visualforce in Page Layout Issues
The end goal I'm trying to reach is a Visualforce page that a particular user profile is directed to everytime they click on a Contact record. This group of users should only be able to access certain Contact records, so I created an extension that checks to see if the ID passed to it should be viewable, and was hoping to just use a <apex:detail /> that display record or disable the detail page and display a message stating that the data is unavailable. I got that working in a page, the problem is that if I drop that page onto a page layout, I end up in an infinite loop- the page is calling the detail, which happens to be the page layout the Visualforce page is on, so it just keeps creating itself inside of itself.
I resigned myself to just manually generating the page field by field instead of using the detail component, but have hit another issue: I can't use the relatedList component on the page unless the related list I'm referencing is on the page layout. If I add the related lists to the page layout, then they get displayed even for Contact records that I'm trying to hide from this user.
I feel like I'm in a bit of a Catch 22. Anyone have any ideas on how I could accomplish this? I'm considering maybe just a redirect from the Contact page to a Visualforce page that does all of this, but that seems a bit clunky. Any ideas would be greatly appreciated.