Reputation: 68
I have added a custom button on the ribbon for the quote entity form. The button is visible and is working as expected when the quote is in draft state.
When I click on the Activate Quote button, the quote becomes active. This action also refreshes the ribbon. After the ribbon is refreshed, I do not see the custom buttons that I had added in the ribbon anymore.
I checked in ribbon workbench and the custom button I added does not have any display rules defined which might cause it to be hidden on Activate quote.
I also checked for any custom scripts which might cause this behavior but I could not find any which would make the custom buttons to be not visible.
I tried adding the custom button to a different group in the ribbon but that doesn't seem to help either.
It seems that the ribbon only shows a predefined set of controls on the quote entity form once the quote has been activated. Does anyone has any suggestions on how I can circumvent this issue?
Below is the ribbondiffxml of the quote entity. The custom buttons that I added are "Copy Estimate" and "New Version"
<?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>
Upvotes: 1
Views: 2001
Reputation: 18082
Try modifying your EnableRule Sol.Form.Estimate.CopyEntity.EnableRule
to negate the create-state.
Your modified rule should look like this:
<EnableRules>
<EnableRule Id="Sol.Form.Estimate.CopyEntity.EnableRule">
<FormStateRule State="Create" InvertResult="true" />
</EnableRule>
</EnableRules>
So instead of formulating
bool enable = FormState == Existing
MS CRM expects
bool enable = !(FormState == Create)
MS concept of Enable- and DisplayRules turned out to be strange more than once to me as well.
Upvotes: 1