需要帮助调试 shows/hides 部分基于机会范围字段的 jscript 事件

Need help debugging jscript event that shows/hides sections based on Opportunity Scope field

我正在尝试根据 "Opportunity Scope" 中选择的内容,使用 jscript 事件来 show/hide 我的商机表单上的选项卡。我已将其设为 OnLoad 事件,以及当 Opportunity Scope 字段更改时的 OnChange 事件。但是,我无法使活动正常进行。我是 javascript 的新手,需要一些调试帮助。 这是我的代码:

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);
    }
  }
}

加载表单时,我收到以下错误:“此记录的脚本之一导致错误。HideShowOpportunityTabs 未定义。

OnChange 事件也不起作用。它不会导致错误,但不会隐藏这些部分。

如果能帮助解决此问题,我们将不胜感激。谢谢!

我通过将双引号的样式更改为“”来解决问题。我还必须将 "new_OpportunityScope" 更改为全部小写。谢谢!