Hello,
I am trying to hide a tab on the form if the segmantid lookup is equal to "Hospitals". When the lookup value is null i get the following error : Cannot read property '0' of null at hideTab
function hideTab() {
Xrm.Page.ui.tabs.get("tab_2").setVisible(false);
var segment = Xrm.Page.getAttribute("segmentid").getValue();
if (segment[0].name == "Hospitals") {
Xrm.Page.ui.tabs.get("tab_2").setVisible(true);
}
else if (!segment || segment.length == 0){
Xrm.Page.ui.tabs.get("tab_2").setVisible(false);
}
else {
Xrm.Page.ui.tabs.get("tab_2").setVisible(false);
}
}
How can i fix this?
Thanks
*This post is locked for comments
I have the same question (0)