我尝试添加一个按钮来连接子网格功能区。仅当主要实体等于“new_visitreport”时,此按钮才应可见。 这是我的尝试:
<CustomAction Id="Visitreports.connection.customAction"
Location="Mscrm.SubGrid.connection.MainTab.Management.Controls._children"
Sequence="15" >
<CommandUIDefinition>
<Button Id="Mscrm.SubGrid.connection.AddXYZ"
ToolTipTitle="$LocLabels:Button.AddXYZ.Label"
ToolTipDescription="$LocLabels:Button.AddXYZ.Tooltip"
LabelText="$LocLabels:Button.AddXYZ.Label"
Command="Button.AddXYZ.Command"
Image16by16="$webresource:new_XYZ_16"
Image32by32="$webresource:new_XYZ_32"
TemplateAlias="o1" />
</CommandUIDefinition>
</CustomAction>
<CommandDefinition Id="Button.AddXYZ.Command">
<EnableRules></EnableRules>
<DisplayRules>
<DisplayRule Id="EntityEqualsVisitreport" />
</DisplayRules>
<Actions>
<JavaScriptFunction FunctionName="openDialog"
Library="$webresource:new_script_open_dialog">
<StringParameter Value="3EEE3AE1-5543-433E-8123-6A14EA925A96" />
<StringParameter Value="3EEE3AE1-5543-433E-8123-6A14EA925A96" />
<BoolParameter Value="false" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
<DisplayRule Id="EntityEqualsVisitreport">
<EntityRule AppliesTo="PrimaryEntity"
EntityName="new_visitreport" />
</DisplayRule>
这条规则似乎总是返回 false。如果我从命令定义中删除显示规则,则按钮可见,但独立于当前主要实体。
我的示例中是否有任何错误,或者尽管支持自定义实体,但它不适用于自定义实体? (MSDN article)
最佳答案
尝试使用FormEntityContextRule
,看起来这些人也遇到了与您相同的问题。 Forum Link
<FormEntityContextRule EntityName="account"/>
关于dynamics-crm-2011 - 自定义实体上的子网格中的 EntityRule 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19976485/