Salesforce – Hide standard buttons display

Below version isn’t working due to cross domain issues (As visualforce pages are served from *.force.com domain and salesforce standard pages are served from *.salesforce.com domain, so it results in cross domain errors).

Please read new working version @ http://www.chiragmehta.info/chirag/2010/08/16/salesforce-hide-standard-buttons-display-working-version/

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: Visualforce Code

    <apex :page sidebar="false" showHeader="false">
    <script language="javascript" type="text/javascript">
    window.onload = new function()
    {
    window.parent.document.getElementsByName("sendEmail")[0].style.display = 'none';
    window.parent.document.getElementsByName("sendEmail")[1].style.display = 'none';
    }
    </script>

    </apex>

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

    <iframe src="/apex/aboveVFPageName" frameborder="0" width="100%" height="100"></iframe>

    STEP3: 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.

    Share and Enjoy:
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • email
    • LinkedIn
    • Live
    • RSS
    Categories: Salesforce
    Jeeedeee
    Thanks for this! Clear explanation, using it now to dynamically change picklist values for countries on pages.
    27 July 10 at 17:16
    Jeeedeee
    I wonder if this is still working? On my developer account it works perfectly, but when switching to the sandbox of my org I got troubles, javascript error “Access denied” on the following line: window.parent.document

    Seems like these is an issue to the fact that Salesforce has moved VF pages away from the original servers to another server.

    Just googled around, e.g. http://community.salesforce.com/t5/Visualforce-Development/Please-explain-cs2-salesforce-com-vs-c-cs2-salesforce-com/m-p/110601 .

    But no solution found yet, anybody any ideas?
    28 July 10 at 18:03
    As visualforce pages are served from *.force.com domain and salesforce standard pages are served from *.salesforce.com domain, so it results in cross domain errors
    28 July 10 at 18:09
    Jeeedeee
    Too bad indeed, I see several other apps (e.g. http://sites.force.com/appexchange/listingDetail?listingId=a0N30000001SqRFEA0) adding details to for example the country field. So there should be a way of making things work. (they also use a sidebar component and VF page)
    28 July 10 at 18:49