I am trying to use a jscript event to show/hide tabs on my Opportunity form based on what is selected in the "Opportunity Scope". I have made this an OnLoad event, as well as an "OnChange" event for when the Opportunity Scope field is changed. However, I haven't been able to get the event to work. I am fairly new to javascript and could use some help debugging.
Here is my code:
function HideShowOpportunityTabs()
{
OppScope = Xrm.Page.getAttribute(“new_OpportunityScope”);
if (OppScope.getValue() != null)
{
if(OppScope.getText()==”Product”)
{
Xrm.Page.ui.tabs.get(“RecurringRevenue”).setVisible(false);
Xrm.Page.ui.tabs.get(“FieldService”).setVisible(false);
}
else if (OppScope.getText()==”Professional Services”)
{
Xrm.Page.ui.tabs.get(“RecurringRevenue”).setVisible(true);
Xrm.Page.ui.tabs.get(“FieldService”).setVisible(true);
}
}
}
When I load the form, I receive the following error:
The "OnChange" event is not working either. It does not cause an error, but the sections are not being hidden.
Any help fixing this would be greatly appreciated. Thanks!