Ye Meri Life Hai – Chirag Mehta

Salesforce – Hide standard buttons display (Working version)

August 16th, 2010

There are many a times where we want to remove few standard buttons from page layout, but there is no such option to remove such restricted buttons. Few such buttons are …

  • “New Note” or “Attach File” button on Google Docs, Notes, & Attachments Related list
  • “Save & Send Invitation” button on New Event page
  • Following is a solution which will hide “Save & Send Invitation” button on New Event page

    STEP1: JAVASCRIPT Code. Create a JS file with below code

    window.onload = new function()
    {
    window.setTimeout(hideBtns,2000);
    }
    function hideBtns()
    {
    if(document.getElementsByName(“sendEmail”)[0]!=null)
    document.getElementsByName(“sendEmail”)[0].style.display = ‘none’;

    if(document.getElementsByName(“sendEmail”)[1]!=null)
    document.getElementsByName(“sendEmail”)[1].style.display = ‘none’;
    }

    STEP2: Upload the JS file as a DOCUMENT

    STEP3: Create a Home Page Component of type (HTML Area)

    <script src=”/servlet/servlet.FileDownload?file=01530000001OcDl”></script>

    Here 01530000001OcDl is ID of document created in STEP2

    STEP4: Add above created Home page component in your home page layout.

    That’s it you are all set, now open New Event and add invitees, automatically the “Save & Send Invitation” button will disappear.

    Please note : If you have some functionality which you want to work across all pages or on every form then navigate to Setup then go to Customize->User Interface, check “Show Custom Sidebar Components on All Pages” under the Sidebar section.

    Comments

    12 Comments

    RSS
    • M says on: August 20, 2010 at 7:41 am

       

      excited to see a solution Ive been looking for a while now…tried it carefully step by step, unfortunately save & send update button on events is still there after adding invitees…can you help please, what am I doing wrong?

    • M says on: August 20, 2010 at 7:49 am

       

      followed steps, did not remove save&send update button on create events…what am I missing? pls help…

    • Jeeedeee says on: August 23, 2010 at 4:27 pm

       

      Yeah, this is working, great. I have used this to modify country field into picklist values rather than a free text field. See also this post on the community site.
      http://community.salesforce.com/t5/Visualforce-Development/Modify-content-on-standard-new-edit-page-for-accounts/td-p/196319

    • M says on: August 29, 2010 at 11:03 pm

       

      I did follow through all the steps but save&send update button is still visible on event page for me…
      any ideas?

    • C says on: October 6, 2010 at 12:49 am

       

      Make sure all double-quotes and single-quotes are standard and not replaced like Word does. Best do this in Notepad.
      When you create Home Page Component – make sure you select the Narrow (Left) Column radio-button. When pasting in the script ensure you ticked the Show HTML check-box before pasting. After saving, go back into the component html and check for strange characters. I found a few like %80%9D had been pasted in somehow. Just remove them and re-save.
      There will always be the name of the component displayed in the side-menu. :-(

    • Indrasen says on: December 24, 2010 at 3:44 pm

       

      Hi,
      Thanks for your post.
      I have custom object ‘Prestart_Checklist__c’.
      Please tell me what should I replace instead of ‘sendEmail’ according to my custom object.

    • Indrasen says on: December 26, 2010 at 11:53 am

       

      Hi,
      I have a custom object Prestart_Cehcklist__c and I want to hide Save and New button while editing the records.
      Please tell me what I need to replace in the above code.

      Thanks,

    • Alok Bhadauria says on: February 15, 2011 at 3:40 pm

       

      Hi,
      Thanks a lot…
      It’s working nice, but my query is , if i deployed it to another org, will it work fine or we’ll need to do some changes? (means.. element’s ids may be different)

    • D says on: March 18, 2011 at 9:14 am

       

      This is very helpful!
      One big problem I am experiencing: “When Show Custom Sidebar Components on All Pages” IS checked related tables are not rendering on any record for any object. I used the exact same code as above.
      Any thoughts?
      Thanks!

    • ashok says on: October 17, 2011 at 4:52 pm

       

      Idea from : Jain Chirag.
      Just if this helps who are struggling with this code.
      1) Please make sure that when you are adding the script to Home page component. Check show html checkbox.
      2) in the same context while adding this script then add this:

      where cs4 stands for server on which your salseforce org resides.and 015P00000009IcW is your JS doc id.

    • Mia says on: October 27, 2011 at 8:04 am

       

      This is awesome! I can’t get this to work however. When I try to paste the script above in the html area, it gets stripped out when I try to save the page. Any thoughts on why this is happening?

    • LJ says on: November 11, 2011 at 3:25 am

       

      I would love to get this to work! I don’t know Java or HTML, but I think I’ve been following instructions exactly. But the button still appears. I’m having the same issue as Mia. I paste in with Show HTML checked and save. When I go back to edit, it has disappeared. Also, when I save the .js file from Notepad which encoding should be used?

    Your email address will not be published. Required fields are marked *

    *