Microsoft Dynamics CRM 2011 – Hide Areas of a Form

These code snippets will hide specific areas of the Form.

// Toggle the Ribbon Toolbar to Show/Hide (same as clicking the show/hide Ribbon button)"minimizeribbon").fireEvent("onclick");

// Hide the Ribbon Toolbar and move the form Content area to the top of the window."crmTopBar").style.display = "none";"crmContentPanel") = "0px"; // Move Form Content area up to top of window, initial is 135px

// Hide Left Hand Nav bar / pane
document.getElementById("crmNavBar") = "none";
document.getElementById("tdAreas").parentElement.parentElement.parentElement.parentElement.colSpan = 2;

// Hide the Breadcrumb and Record Set Toolbar
document.getElementById("recordSetToolBar") = "none";

// Hide the Form Footer Bar
document.getElementById("crmFormFooter") = "none";



About Rhett Clinton MVP
Dynamics CRM MVP

23 Responses to Microsoft Dynamics CRM 2011 – Hide Areas of a Form

  1. Geert says:

    Hey, any idea how to disable custom button on a ribbon?
    Something like if form is in create mode disable button…

    • You can use the FormStateRule (RibbonDiffXml) which is a child element of the DisplayRule (RibbonDiffXml) of the Ribbon XML schema, for defining when a ribbon element should be shown. If you check ou the CRM 2011 SDK and search for FormStateRule (RibbonDiffXml) you will find information on the Ribbon XML Reference with guides on how to edit the XML for the Ribbon. This will be the best and supported way.

      In an unsupported way, if you locate the button element’s id in the DOM which (for example on the Account form, the Assign button) may resemble something like account|NoRelationship|Form|Mscrm.Form.account.Assign-Large, but there is no guarantee that this will always be this, you could try something like

      if(“account|NoRelationship|Form|Mscrm.Form.account.Assign-Large”))“account|NoRelationship|Form|Mscrm.Form.account.Assign-Large”).style.display = “none”;

      Anyhow, I hope this helps you out.


  2. Pingback: Working with CRM Forms in IFrame in CRM 2011 « Nishant Rana's Weblog

  3. Stefan says:

    Toggling the ribbon toolbar did not work for me unless i used it with the setTimeout function. It seems the page is not fully loaded when the fireEvent method is executed.

    How i got it working:

    toggleRibbonbar: function () {
    setTimeout(function () {“minimizeribbon”).fireEvent(“onclick”); }, 0);

    • Thats great to know Stefan, thanks.

      if you’re using this in the onload event than presumeably the form scripts haven’t fully initialised yet so a setTimeout will do the trick, if you’re using this in any other form event (onsave, onchange) it should be fine without setTimeout.


  4. cptboa says:

    Hi there,

    is it possible minimize the ribbon toolbar with JavaScript on onLoad like in this example?

    Thanks in advance,

    • The method I’ve used and have in this blog post is by using this code.“minimizeribbon”).fireEvent(“onclick”);

      It is just like clicking the minimise ribbon button but instead just calling it through script..


      • cptboa says:

        First thanks for your quick answer Rhett 🙂

        I made a JScript Web Resource, the function there is called toggleRibbonbar:×546/1.png.html

        Then I placed that e.g. on the account entity:×542/2.png.html

        So when I open an account now, I get this error:×214/3.png.html

        Well which object is there expected? Any ideas? Thanks again 🙂

      • I think the double quotes in the script may have been corrupt, can you copy and paste the example again from this blog or simply remove the double quotes and add them back in your script file.


      • Mohsinkhan says:

        Hi Rhett,
        I am trying to use your code.
        // Toggle the Ribbon Toolbar to Show/Hide (same as clicking the show/hide Ribbon button)“minimizeribbon”).fireEvent(“onclick”);
        But i am not getting any changes. Can you tell me how to use the code. I created a webresource and called the function onLoad and Onsave events. But I get a error as object expected. No other function is called in OnLoad or Onsave event.
        I even changed the Quotes.


      • This looks for the minimizeribbon element by moving to the top of the DOM and then getting the element by id.“minimizeribbon”).fireEvent(“onclick”);

        If you use the IE developer tools (F12) then you can start script debugging and inspect the object“minimizeribbon”) to see if its found. Otherwise you can also look through HTML in the IE developer tool to see where this object exists.


      • Mohsinkhan says:

        Yeah I am Able to find it but, i dont know why i am i getting error.

  5. cptboa says:

    Thanks pal! You’re right, the double quotes were corrupt! Now your example works! Thanks again! Have a great day!


  6. zhongyue1982 says:

    Hi, is it possible to hide all ribbon toolbar, includes dashbord?

  7. Pingback: CRM 2011 – Hiding a Form’s Header and Footer « .Net'ers

  8. Prabhu G says:

    This script works great for single form. When navigate to second form, its get expanded, then 3rd form its get collapsed.

    setTimeout(function () {“crmRibbonManager”).control.set_isMinimized(true); }, 0);

    This script helps me.

    Prabhu G

  9. Moe says:

    Hi Clinton,

    Great post!

    Is this supported functionality? Would I be able to deploy a solution to CRM Online which uses the above code?


    • Hi Moe,

      This is not supported javascript but it should deploye to CRM Online without any problem. Be aware that future Rollups may affect the layout of the UI and break this code.


  10. Xitij Thool says:

    worked good only If all code is copied correctly it will hide all and other thing will be hidden by CSS , but if copied only two lines IE8* crashes after Maximize.

  11. Iain Wright says:

    Is there a way to fire the hide of the toolbar on load of the CRM “homepage”?

  12. Pingback: iframe onSave Events in MS CRm 2011 | Vivek's MIcrosoft Dynamics XRM Knowledge Base (Mine ==> Preserve)

  13. Bipin Kumar says:

    How to hide Header lookup field using Javascript in CRM 2013 ?

    I am using below function but it is not working

    Please Help !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: