Could you please help me in correcting this JS if it has any mistakes ... It gives me an error... thanks for any help you can give...I am really a beginner. I put it ON LOAD on the form, and ON CHANGE on the look up field. It
works when I create and save a new opportunity. But if I try displaying the already existing opportunities, it gives an error on load.
I need that the tab called: CABLE OPPORTUNITIES - SPECIFIC FIELDS is hidden when the customergroupid field contains an option from P0 to P8. The function I entered is this one
function HideShowCableTab()
{
if (Xrm.Page.getAttribute("scapa_customergroupid").getValue()!=null && (Xrm.Page.getAttribute("scapa_customergroupid").getValue()[0].name == "P0"
|| Xrm.Page.getAttribute("scapa_customergroupid").getValue()[0].name == "P1"
|| Xrm.Page.getAttribute("scapa_customergroupid").getValue()[0].name == "P2"
|| Xrm.Page.getAttribute("scapa_customergroupid").getValue()[0].name == "P3"
|| Xrm.Page.getAttribute("scapa_customergroupid").getValue()[0].name == "P4"
|| Xrm.Page.getAttribute("scapa_customergroupid").getValue()[0].name == "P5"
|| Xrm.Page.getAttribute("scapa_customergroupid").getValue()[0].name == "P6"
|| Xrm.Page.getAttribute("scapa_customergroupid").getValue()[0].name == "P7"
|| Xrm.Page.getAttribute("scapa_customergroupid").getValue()[0].name == "P8"))
{
Xrm.Page.ui.tabs.get("CABLE OPPORTUNITIES - SPECIFIC FIELDS").setVisible(true);
}
else
{
Xrm.Page.ui.tabs.get("CABLE OPPORTUNITIES - SPECIFIC FIELDS").setVisible(false);
}
}