function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
disturbed118disturbed118 

javascript to hide related list buttons on an object view page

hi i am trying to hide buttons on some related list areas on the contact view page but can't seem to get any success using javascript to scan for the buttons, any helpers?

 

shillyershillyer

Why not just remove the related list buttons from the page layout editor?

 

Best,

Sati

disturbed118disturbed118
you can't for notes and attachments etc... i want to hide the new note button
werewolfwerewolf
You're not going to be able to hide that with Javascript.  JS on Salesforce.com pages is served from a separate domain, so it can't touch the main page.
disturbed118disturbed118
there must be a way
disturbed118disturbed118
Can't i not get all the elements on the page i.e in this case the contact page and look for that element name i can see the name is newNote for that button :(
werewolfwerewolf

Not from a different domain you can't.  I guarantee you you will not be able to do this with Javascript.

 

You could replace the detail page with a Visualforce page that has an <apex:detail> and then put a custom Attachments related list at the bottom that has no Notes.