Hello-
I am working in CRM2011. I created a custom form with 9 tabs. 2 tabs will be visible always and I want to hide 7 tabs on load. Of the 7 I only wabt tabs to be visible based on a selected picklist value. I wrote the below code but it is not working. It is OnLoad and OnChange event. Error 'tab_1' is undefined.
function hideTabSection() {
if (Xrm.Page.getAttribute("cpdc_requesttype").getSelectedOption() == null) {
Xrm.Page.ui.tabs.get("tab_1").setVisible(false);
Xrm.Page.ui.tabs.get("tab_4").setVisible(false);
Xrm.Page.ui.tabs.get("tab_6").setVisible(false);
Xrm.Page.ui.tabs.get("tab_7").setVisible(false);
Xrm.Page.ui.tabs.get("tab_8").setVisible(false);
Xrm.Page.ui.tabs.get("tab_9").setVisible(false);
Xrm.Page.ui.tabs.get("tab_10").setVisible(false);
} else {
var option = Xrm.Page.getAttribute("cpdc_requesttype").getSelectedOption().text;
if (option == "Add/Edit Internal Event") {
Xrm.Page.ui.tabs.get("tab_1").setVisible(true);
Xrm.Page.ui.tabs.get("tab_4").setVisible(false);
Xrm.Page.ui.tabs.get("tab_6").setVisible(false);
Xrm.Page.ui.tabs.get("tab_7").setVisible(false);
Xrm.Page.ui.tabs.get("tab_8").setVisible(false);
Xrm.Page.ui.tabs.get("tab_9").setVisible(false);
Xrm.Page.ui.tabs.get("tab_10").setVisible(false);
} else if (option == "Lawyer Departure") {
Xrm.Page.ui.tabs.get("tab_4").setVisible(true);
Xrm.Page.ui.tabs.get("tab_1").setVisible(false);
Xrm.Page.ui.tabs.get("tab_6").setVisible(false);
Xrm.Page.ui.tabs.get("tab_7").setVisible(false);
Xrm.Page.ui.tabs.get("tab_8").setVisible(false);
Xrm.Page.ui.tabs.get("tab_9").setVisible(false);
Xrm.Page.ui.tabs.get("tab_10").setVisible(false);
} else if (option == "Total Bio Change") {
Xrm.Page.ui.tabs.get("tab_6').setVisible(true);
Xrm.Page.ui.tabs.get("tab_1").setVisible(false);
Xrm.Page.ui.tabs.get("tab_4").setVisible(false);
Xrm.Page.ui.tabs.get("tab_7").setVisible(false);
Xrm.Page.ui.tabs.get("tab_8").setVisible(false);
Xrm.Page.ui.tabs.get("tab_9").setVisible(false);
Xrm.Page.ui.tabs.get("tab_10").setVisible(false);
} else if (option == "Bio Section Change") {
Xrm.Page.ui.tabs.get("tab_7").setVisible(true);
Xrm.Page.ui.tabs.get("tab_1").setVisible(false);
Xrm.Page.ui.tabs.get("tab_4").setVisible(false);
Xrm.Page.ui.tabs.get("tab_6").setVisible(false);
Xrm.Page.ui.tabs.get("tab_8").setVisible(false);
Xrm.Page.ui.tabs.get("tab_9").setVisible(false);
Xrm.Page.ui.tabs.get("tab_10").setVisible(false);
} else if (option == "PG/IG Capability Change") {
Xrm.Page.ui.tabs.get("tab_8").setVisible(true);
Xrm.Page.ui.tabs.get("tab_1").setVisible(false);
Xrm.Page.ui.tabs.get("tab_4").setVisible(false);
Xrm.Page.ui.tabs.get("tab_6").setVisible(false);
Xrm.Page.ui.tabs.get("tab_7").setVisible(false);
Xrm.Page.ui.tabs.get("tab_9").setVisible(false);
Xrm.Page.ui.tabs.get("tab_10").setVisible(false);
} else if (option == "New Joiner") {
Xrm.Page.ui.tabs.get("tab_9").setVisible(true);
Xrm.Page.ui.tabs.get("tab_1").setVisible(false);
Xrm.Page.ui.tabs.get("tab_4").setVisible(false);
Xrm.Page.ui.tabs.get("tab_6").setVisible(false);
Xrm.Page.ui.tabs.get("tab_7").setVisible(false);
Xrm.Page.ui.tabs.get("tab_8").setVisible(false);
Xrm.Page.ui.tabs.get("tab_10").setVisible(false);
} else if (option == "PR News") {
Xrm.Page.ui.tabs.get("tab_10").setVisible(true);
Xrm.Page.ui.tabs.get("tab_1").setVisible(false);
Xrm.Page.ui.tabs.get("tab_4").setVisible(false);
Xrm.Page.ui.tabs.get("tab_6").setVisible(false);
Xrm.Page.ui.tabs.get("tab_7").setVisible(false);
Xrm.Page.ui.tabs.get("tab_8").setVisible(false);
Xrm.Page.ui.tabs.get("tab_9").setVisible(false);
}
}
}
*This post is locked for comments