locked
Microsoft Dynamics CRM 2011 - JavaScript query RRS feed

  • Question

  • Hello,

    I'm relatively new to CRM 2011 and implementing JavaScript. I have the below scenario:

    I have a picklist which contains "company" and "site". On the same form as the picklist on the accounts entity, I have 2 tabs called "tab 1" and "tab 2". I need to make "tab1" invisible when the picklist equals "site" and "tab 2" invisible when the picklist equals "company" (onload). Could anyone throw something together for me? I'm currently learning JavaScript however this is an immediate requirement for the organisation I'm working for.

    I look forward to your  response/s.

    Regards


    Sam

    Thursday, August 15, 2013 11:46 AM

All replies

  • function HideShowSection() {
        if (Xrm.Page.ui.getFormType() ==2){
               if (Xrm.Page.getAttribute("EnterFieldNameHere").getSelectedOption().text == "company") {
                Xrm.Page.ui.tabs.get(0).setVisible(true);
      Xrm.Page.ui.tabs.get(1).setVisible(false);


                }
               else if (Xrm.Page.getAttribute("EnterFieldNameHere").getSelectedOption().text == "site") {
                Xrm.Page.ui.tabs.get(0).setVisible(false);
      Xrm.Page.ui.tabs.get(1).setVisible(true);


                }
    else             {
                Xrm.Page.ui.tabs.get(0).setVisible(false);
      Xrm.Page.ui.tabs.get(1).setVisible(false);


                }
    }
    }


    Regards Faisal

    Thursday, August 15, 2013 12:44 PM