crm 2011功能区:禁用系统按钮

时间:2014-08-26 10:26:46

标签: dynamics-crm-2011 ribbon

我在通过javascript自定义规则禁用功能区按钮时遇到问题。

我要添加“启用规则”的操作称为Mscrm.AddExistingRecordFromSubGridAssociated - >当子网格获得焦点时显示。

我使用Ribbon工作台解决方案,我几乎可以肯定我做的一切都很好,但它不起作用。

的javascript:

utils.ribbon.isAddExistingDisabled = function(grid) {
 return false; //just for test I wrote always false, but it's enabled anyway :/
}

CommandDef:

<CommandDefinition Id="Mscrm.AddExistingRecordFromSubGridAssociated">
      <EnableRules>
        <EnableRule Id="Mscrm.AppendToPrimary" />
        <EnableRule Id="Mscrm.EntityFormIsEnabled" />
        <EnableRule Id="my.incident.addMainCause.EnableRule" />
      </EnableRules>
      <DisplayRules>
        <DisplayRule Id="Mscrm.AddExisting" />
        <DisplayRule Id="Mscrm.ShowForManyToManyGrids" />
        <DisplayRule Id="Mscrm.AppendToPrimary" />
        <DisplayRule Id="Mscrm.AppendSelected" />
      </DisplayRules>
      <Actions>
        <JavaScriptFunction FunctionName="Mscrm.GridRibbonActions.addExistingFromSubGridAssociated" Library="/_static/_common/scripts/RibbonActions.js">
          <CrmParameter Value="SelectedEntityTypeCode" />
          <CrmParameter Value="SelectedControl" />
        </JavaScriptFunction>
      </Actions>
    </CommandDefinition>

启用规则def:

<EnableRule Id="my.incident.addMainCause.EnableRule">
        <CustomRule FunctionName="utils.ribbon.isAddExistingDisabled" Library="$webresource:my_js/incident/common.js" InvertResult="false">
          <CrmParameter Value="SelectedControl" />
        </CustomRule>
      </EnableRule>

0 个答案:

没有答案