1

我在功能区上为报价实体表单添加了一个自定义按钮。当报价处于草稿状态时,该按钮可见并按预期工作。

当我单击激活报价按钮时,报价变为活动状态。此操作还会刷新功能区。刷新功能区后,我不再看到我在功能区中添加的自定义按钮。

我签入了功能区工作台,并且我添加的自定义按钮没有定义任何显示规则,这可能导致它在激活报价时被隐藏。
我还检查了任何可能导致此行为的自定义脚本,但我找不到任何会使自定义按钮不可见的脚本。

我尝试将自定义按钮添加到功能区中的不同组,但这似乎也无济于事。

一旦报价被激活,功能区似乎只在报价实体表单上显示一组预定义的控件。有人对我如何规避这个问题有任何建议吗?

下面是报价实体的ribbondiffxml。我添加的自定义按钮是“复制估计”和“新版本”

<?xml version="1.0" encoding="utf-16"?>
<RibbonDiffXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <CustomActions>
    <CustomAction Id="Sol.Form.Estimate.CopyEntity.Button.CustomAction" Location="Mscrm.Form.quote.MainTab.Actions.Controls._children" Sequence="4">
      <CommandUIDefinition>
        <Button Alt="$LocLabels:Sol.Form.Estimate.CopyEntity.Button.Alt" Command="Sol.Form.Estimate.CopyEntity.Command" Description="Copy Estimate" Id="Sol.Form.Estimate.CopyEntity.Button" Image32by32="$webresource:mcace_EntityRibbon_32x32.png" Image16by16="$webresource:mcace_EntityRibbon_16x16.png" LabelText="$LocLabels:Sol.Form.Estimate.CopyEntity.Button.LabelText" Sequence="4" TemplateAlias="o1" ToolTipTitle="$LocLabels:Sol.Form.Estimate.CopyEntity.Button.ToolTipTitle" ToolTipDescription="$LocLabels:Sol.Form.Estimate.CopyEntity.Button.ToolTipDescription" />
      </CommandUIDefinition>
    </CustomAction>
    <CustomAction Id="Sol.Form.Estimate.NewVersion.Button.CustomAction" Location="Mscrm.Form.quote.MainTab.Actions.Controls._children" Sequence="4">
      <CommandUIDefinition>
        <Button Alt="$LocLabels:Sol.Form.Estimate.NewVersion.Button.Alt" Command="Sol.quote.Estimate.NewVersion.Command" Description="New Version" Id="Sol.Form.Estimate.NewVersion.Button" Image32by32="/_imgs/SFA/ReviseQuote_32.png" Image16by16="/_imgs/SFA/ReviseQuote_16.png" LabelText="$LocLabels:Sol.Form.Estimate.NewVersion.Button.LabelText" Sequence="4" TemplateAlias="o1" ToolTipTitle="$LocLabels:Sol.Form.Estimate.NewVersion.Button.ToolTipTitle" ToolTipDescription="$LocLabels:Sol.Form.Estimate.NewVersion.Button.ToolTipDescription" />
      </CommandUIDefinition>
    </CustomAction>
    <HideCustomAction HideActionId="Sol.Mscrm.Form.quote.ReviseQuote.Hide" Location="Mscrm.Form.quote.ReviseQuote" />
  </CustomActions>
  <Templates>
    <RibbonTemplates Id="Mscrm.Templates" />
  </Templates>
  <CommandDefinitions>
    <CommandDefinition Id="Sol.Form.Estimate.CopyEntity.Command">
      <EnableRules>
        <EnableRule Id="Sol.Form.Estimate.CopyEntity.EnableRule" />
      </EnableRules>
      <DisplayRules />
      <Actions>
        <JavaScriptFunction FunctionName="triggerCopyEntity" Library="$webresource:sol_Entity_Ribbon.js" />
      </Actions>
    </CommandDefinition>
    <CommandDefinition Id="Sol.quote.Estimate.NewVersion.Command">
      <EnableRules>
        <EnableRule Id="Sol.Form.Estimate.CopyEntity.EnableRule" />
      </EnableRules>
      <DisplayRules />
      <Actions>
        <JavaScriptFunction FunctionName="setIsNewVersionField" Library="$webresource:sol_Estimate_ribbon" />
      </Actions>
    </CommandDefinition>
  </CommandDefinitions>
  <RuleDefinitions>
    <TabDisplayRules />
    <DisplayRules>
      <DisplayRule Id="Sol.Form.Estimate.DisplayRule.DisplayRule">
        <CrmClientTypeRule Type="Web" Default="true" />
      </DisplayRule>
    </DisplayRules>
    <EnableRules>
      <EnableRule Id="Sol.Form.Estimate.CopyEntity.EnableRule">
        <FormStateRule State="Existing" Default="false" InvertResult="false" />
      </EnableRule>
    </EnableRules>
  </RuleDefinitions>
  <LocLabels>
    <LocLabel Id="Sol.Form.Estimate.CopyEntity.Button.LabelText">
      <Titles>
        <Title description="Copy Estimate" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="Sol.Form.Estimate.CopyEntity.Button.ToolTipTitle">
      <Titles>
        <Title description="Copy Estimate" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="Sol.Form.Estimate.CopyEntity.Button.ToolTipDescription">
      <Titles>
        <Title description="Copy Estimate" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="Sol.Form.Estimate.CopyEntity.Button.Alt">
      <Titles>
        <Title description="Copy Estimate" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="Sol.Form.Estimate.NewVersion.Button.LabelText">
      <Titles>
        <Title description="New Version" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="Sol.Form.Estimate.NewVersion.Button.ToolTipTitle">
      <Titles>
        <Title description="New Version" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="Sol.Form.Estimate.NewVersion.Button.ToolTipDescription">
      <Titles>
        <Title description="New Version" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="Sol.Form.Estimate.NewVersion.Button.Alt">
      <Titles>
        <Title description="New Version" languagecode="1033" />
      </Titles>
    </LocLabel>
  </LocLabels>
</RibbonDiffXml>
4

1 回答 1

1

尝试修改您的 EnableRuleSol.Form.Estimate.CopyEntity.EnableRule以否定创建状态。

您修改后的规则应如下所示:

<EnableRules>
  <EnableRule Id="Sol.Form.Estimate.CopyEntity.EnableRule">
    <FormStateRule State="Create" InvertResult="true" />
  </EnableRule>
</EnableRules>

所以而不是制定

bool enable = FormState == Existing

MS CRM 期望

bool enable = !(FormState == Create)

事实证明,MS 的 Enable- 和 DisplayRules 概念对我来说也很奇怪。

于 2016-01-25T20:38:12.040 回答