Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am showing Notes & Attachment section. I want to hide "New Note" button on the related list. I don't find any way for doing that. How can I do that? Any thoughts?

share|improve this question
add comment

6 Answers

There is a way, but it is a discouraged practice as it a dependency on the salesforce html, which may change without notice. Using a homepage/sidebar component you could run javascript to locate and hide the button.

If you use it, please only do it as an improvement of the gui/interface workflow, I'd avoid making any important functionality depend on this kind of modifying of the SF gui.

for instance (removing the name label & input ):

if (document.location.href.toString().indexOf("/a4C") != -1) { /*Hide object name input controls*/
        $('input#Name').parent('div').parent('td').parent('tr').hide(); /*hide the usertype selector, only standard users can be employees*/
        $('select#CF00NM0000000adqZ_mlktp').hide(); /*hide the name output on employee detail page*/
        $('#Name_ileinner').parent('td').parent('tr').hide();
    }
share|improve this answer
add comment

There are no explicit profile permissions to control Notes and Attachments just yet. So if you have, I believe Edit access to the Record, you would probably be able to add a Note or an Attachment.

A few ways to work around it : a)A trigger on attachment preventing insertion of attachment by checking the User Profile and using the control conditions that are relevant to you.

b)Get rid of the standard Attachment related list and use a VF Section (You lose the hover link at the top though)

share|improve this answer
add comment

I managed to do this via a Visualforce page and the apex:relatedList component. It allows you to override the header facet.

<apex:page standardController="Test__c">
   <apex:detail />
   <apex:relatedList list="NotesAndAttachments">
      <apex:facet name="header"><table><tr><td class="pbTitle"><h3>Notes and Attachments</h3></td></tr></table></apex:facet>
   </apex:relatedList>
</apex:page>

I then changed the Action override for the View action to use this page when the user views the record. The result was this...

enter image description here

Note this approach does have its downsides, it only partially obeys Layouts via apex:detail, other related lists will need to be added to the page. Though I am sure possible, I didn't go as far as putting the chatter components on the page, not sure if you need that or not.

P.S. I also tried this as VF page (without the tag) embedded into the native layout. Which worked up until the point I clicked Edit the note, as its in an IFRAME it opened in the frame. Shame!

share|improve this answer
add comment

As far as I know, this can't be done, however, there is an Idea for that:

IdeaExchange Salesforce

share|improve this answer
add comment

Thanks guys your suggestions were really helpful. I think we can use below two approaches for hiding new note button if you override your view action with VF page for an object.

<script type="text/javascript">
$j = jQuery.noConflict();

$j(document).ready(function(){
    // hide new note button
    $j("input[name=newNote]").hide();       
});

</script>

or

<style>
input[name=newNote] {
    display: none;
}
</style>
share|improve this answer
    
If you accept one of the answers by clicking the (v) icon below the upvotes, other users know your question has been solved. –  Samuel De Rycke Oct 25 '12 at 7:36
add comment

You can use

<apex:relatedList list="CombinedAttachments" subject"--->
<apex:facet name="header"><center><b>Notes & Attachments</b></center></apex:facet>
<apex:relatedList>

This will hide the buttons.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.