I'm trying to hide / show a tab based on whether a field contains a value and I'm using the following Javascript which I've added as a Web Resource etc:
function hideShowTab() {
var type = Xrm.Page.getAttribute(/sic_wikipedia/).getValue();
if (Type != //) {
window.parent.Xrm.Page.ui.tabs.get(/tab_16/).setVisible(true);
}
else {
window.parent.Xrm.Page.ui.tabs.get(/tab_16/).setVisible(false);
}
}
So, in this case I don't want tab_16 to be visible if the sic_wikipedia field does not contain data. The tab known as tab_16 (on the Form in PowerApps and in the Javascript) is actually called BURSARIES on the Form as per the image below:
Could anyone please let me know what I'm doing wrong? I have a feeling that it's something to do with the line if (Type != //) { in the Javascript, but changing the word Type to e.g. Wikipedia makes the Javascript crash as it says that Wikipedia is not defined.
Many thanks
Jon