+ Start a Discussion

Problems in using relatedList in Visualfoce page

Hi there,


I am sure some of you guys came across this issue already, but here is the issue that I have:


1. I have a custom object that has a look up to an Account.

2. I have a custom visualforce page for Account and I have the custom object as a related list.

3. I know that if the user's profile does not have atleast read access on the custom object it will throw an exception. So on the rendered property, I have added to see if the user is able to access the object.

4. I also know that the related list has to be in the page layouts, otherwise it will throw the same exception, so I have added the object as a related list.

5. Now at the user level, each user can customize their page view, but removing the related lists. If the pagelayout has the related list, and if the user customize it to remove it, it will throw an exception. This could cause a nasty error in Production, which it did.


I want to know if there is a way to check if the current user's page layout has the object as a related list through code. Is this possible? Thanks.




I think you'll struggle with this, as the page layout is part of the metadata api, not apex.


I assume this isn't an exception that you can catch?