function hideSubgridsOnLoad() {
//Hide SubGrid OnLoad: Crew Nationality - But not on mobile
if (Xrm.Page.context.client.getClient() != "Mobile")
{
Xrm.Page.ui.controls.get('crewnationalitygrid').setVisible(false);
}
}
function showHideSubgrids() {
var MarketLabel;
var ConceptProductLabel;
//Get Value of Market
var Market = Xrm.Page.data.entity.attributes.get('ap_market');
if (Market.getValue() != null) {
MarketLabel = Market.getValue()[0].name;
}
//Get Value of Concept/Product
var ConceptProduct = Xrm.Page.data.entity.attributes.get('ap_conceptproduct');
if (ConceptProduct.getValue() != null) {
ConceptProductLabel = ConceptProduct.getValue()[0].name;
}
//If Concept/Product equals Saatsea then show Crew Nationality Sub-Grid - But not on mobile
if (ConceptProductLabel == "Saatsea") {
//Show Sections:
if (Xrm.Page.context.client.getClient() != "Mobile")
{
Xrm.Page.ui.controls.get('crewnationalitygrid').setVisible(true);
}
Xrm.Page.ui.tabs.get("tab_products").setVisible(false);
}
//If Market equals Newbuiding then show Tab: Newbuilding Information
else if (MarketLabel == "Newbuilding" && ConceptProductLabel == "Liferaft" || ConceptProductLabel == "Full Package for NB" || ConceptProductLabel == "Davit/Lifeboat") {
Xrm.Page.ui.tabs.get("tab_newbuildinginformation").setVisible(true);
}
//If Market equals Newbuiding AND Concept/Product equals MES Passenger OR MES Offshore then show Tab: Products
else if (MarketLabel == "Newbuilding" && ConceptProductLabel == "MES Passenger" || ConceptProductLabel == "MES Offshore") {
//Show Products
Xrm.Page.ui.tabs.get("tab_newbuildinginformation").setVisible(true);
Xrm.Page.ui.tabs.get("tab_products").setVisible(true);
}
//If Market equals Replacement AND Concept/Product equals MES Passenger OR MES Offshore OR PPE Fire then show Tab: Products
else if (MarketLabel == "Replacement" && ConceptProductLabel == "MES Passenger" || ConceptProductLabel == "MES Offshore" || ConceptProductLabel == "PPE Fire") {
//Show Products
Xrm.Page.ui.tabs.get("tab_products").setVisible(true);
}
//Otherwise just hide Sub-Grid: Crew Nationality and Tab: Products + Newbuilding Information
else {
if (Xrm.Page.context.client.getClient() != "Mobile")
{
Xrm.Page.ui.controls.get('crewnationalitygrid').setVisible(false);
}
Xrm.Page.ui.tabs.get("tab_newbuildinginformation").setVisible(false);
Xrm.Page.ui.tabs.get("tab_products").setVisible(false);
}
}
This is the javascript i am using