Hi all,
I have this javascript and the third else if doesn't work for contactype = one of these (Client|Database|Supplier|Partner Contact) it changes to the second else if.
I have removed the nested else and the bottom else with no change.
I have also removed the third else if as these are the only options left however still matches second else if.
As far as I'm aware you can use multiple else if.
function showHidecontactTabs()
{
var contactType = Xrm.Page.getAttribute("eye_contacttypes");
setTimeout(function(){
if (contactType.getValue() != null)
{
contactType = contactType.getSelectedOption().text;
if (contactType.match(/^(Hub Alumni|Hub Chair|Hub Lead|Hub Member – Financial|Hub Member – Funded|Hub Member - Non Financial|Hub Member - On Hold|Hub Member – Partial|Hub Member - Scholarship Free NPA|Hub Prospect)$/)) {
Xrm.Page.ui.tabs.get("member").setVisible(true);
Xrm.Page.ui.tabs.get("coaches").setVisible(false);
Xrm.Page.ui.tabs.get("hub").setVisible(true);
Xrm.Page.ui.tabs.get("coach").setVisible(false);
}
else if (contactType.match(/^(Hub Member - Coach Member)$/)) {
Xrm.Page.ui.tabs.get("member").setVisible(true);
Xrm.Page.ui.tabs.get("coaches").setVisible(true);
Xrm.Page.ui.tabs.get("hub").setVisible(true);
Xrm.Page.ui.tabs.get("coach").setVisible(true);
}
else if (contactType.match(/^(Coaching Alumni|Coaching Member|Coaching Prospect)$/)) {
Xrm.Page.ui.tabs.get("member").setVisible(false);
Xrm.Page.ui.tabs.get("coaches").setVisible(true);
Xrm.Page.ui.tabs.get("hub").setVisible(false);
Xrm.Page.ui.tabs.get("coach").setVisible(true);
}
else if (contactType.match(/^(Client|Database|Supplier|Partner Contact)$/)) {
Xrm.Page.ui.tabs.get("member").setVisible(false);
Xrm.Page.ui.tabs.get("coaches").setVisible(true);
Xrm.Page.ui.tabs.get("hub").setVisible(false);
Xrm.Page.ui.tabs.get("coach").setVisible(true);
}
else
{
Xrm.Page.ui.tabs.get("member").setVisible(false);
Xrm.Page.ui.tabs.get("coaches").setVisible(false);
Xrm.Page.ui.tabs.get("hub").setVisible(false);
Xrm.Page.ui.tabs.get("coach").setVisible(false);
}
}
else
{
Xrm.Page.ui.tabs.get("member").setVisible(false);
Xrm.Page.ui.tabs.get("coaches").setVisible(false);
Xrm.Page.ui.tabs.get("hub").setVisible(false);
Xrm.Page.ui.tabs.get("coach").setVisible(false);
}
},3000);
}