Sunday, 4 September 2011

At Last!! Hide Tab (Section) in CRM 2011 with Javascript!!!

Hi!

Ok, i realise that , for everyone else, this is not an earth shattering piece of JavaScript but this has been bugging me for Aaaaaaaaaaages!!!



I have been looking for the JavaScript to hide Tab (or what is now known as a section) in CRM 2011. Every other blog/SDK/forum post i read suggested the following:

   1:  Xrm.Page.ui.tabs.get(5).SetVisible(false);


   2:  Xrm.Page.ui.tabs.get(5).SetVisible(true);




No matter how i tried i could not get this to work. However, after some detective work……and reading this blog post (cheers) i realised that the bit i was missing was that in  the script, the brackets need to contain the name of the tab (name, not the Label). However, it has to be contained in “”. So my code was…



   1:  Xrm.Page.ui.tabs.get("tab_3").SetVisible(false);


   2:  Xrm.Page.ui.tabs.get("tab_3").SetVisible(true);





Sorted! Hope that helps


Cheers


xRM Consultant

3 comments:

  1. Xrm.Page.ui.tabs.get(5).SetVisible(false); doesn’t work

    Xrm.Page.ui.tabs.get(5).setVisible(false); it’s working

    ReplyDelete
  2. write setVisible , no SetVisible. no capital S :-)

    ReplyDelete
  3. how to change the background color of a tab / section

    ReplyDelete