You need to sign in to do that
Don't have an account?
Access elements of parent record from inline visualforce page
Hi All,
I have an inline vf in a record detail page. I would like to hide some attributes of the record detail (say notes and attachments) by calling a javascript from the inline. Below is the snippet:
<script>
var previousOnload = window.onload;
window.parent.onload = function() {
if (previousOnload) {
previousOnload();
}
document.getElementsByClassName('listRelatedObject Custom78Block')[0].style.display = 'none'
}
</script>
Here i ve got the class name by inspecting the element in browser. But when i try to run this, i get an error in the error console as: Permission denied to access property onload......
Is there any workaround for this?
Thanks in advance,
Dave.
Hi Bob,
Thanks for the quick reply. Is there any other way to do this?
My requirement is to remove the notes and attachment related list from record detail page but the hover link for the same should be visible on the top.
I am displaying all the notes and attachments of this object and the related child objects in the inline vf, so need to remove the standard N & A related list but still make it available on hover on top of page.
Thanks and regards,
Dave.
All Answers
You can't do that I'm afraid - as the inline VF page is served from a separate server, the browser blocks any attempt to access the standard page dom as a cross site scripting attack.
Hi Bob,
Thanks for the quick reply. Is there any other way to do this?
My requirement is to remove the notes and attachment related list from record detail page but the hover link for the same should be visible on the top.
I am displaying all the notes and attachments of this object and the related child objects in the inline vf, so need to remove the standard N & A related list but still make it available on hover on top of page.
Thanks and regards,
Dave.
The only way I know of to influence the standard page is to embed an html area in the sidebar. This can then change the page based on the contents. However, I'm not sure that will be able to know about th embedded VF, so it may not be entirely suitable for your purposes.