Playing with the ribbon, I tried to add a button over the account entity homepage's ribbon/command bar, just before the +New button. But it is not showing anywhere over the page. What am I missing?

This is the sample XML I've coded after reading the SDK.

            <RibbonDiffXml>
            <CustomActions>
                <CustomAction Id="Bee.CustomAction.GoToUrl" Location="Mscrm.HomepageGrid.account.MainTab.Management.Controls._children">
                    <CommandUIDefinition>
                        <Button Id="Bee.HomepageGrid.account.GoToUrl" Command="Bee.CommandDefinition.GoToUrl" LabelText="Go To URL" ToolTipDescription="Description, Go to URL with selected account" ToolTipTitle="Title, Go to URL with selected account" />
                    </CommandUIDefinition>
                </CustomAction>
            </CustomActions>
            <Templates>
                <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
            </Templates>
            <CommandDefinitions>
                <CommandDefinition Id="Bee.CommandDefinition.GoToUrl">
                    <EnableRules>
                        <EnableRule Id="Bee.EnableRule.SelectionCountOne" />
                    </EnableRules>
                    <DisplayRules>
                        <DisplayRule Id="Bee.DisplayRule.AllClients"/>
                    </DisplayRules>
                    <Actions>
                        <Url Address="http://localhost/mysite" PassParams="true"></Url>
                    </Actions>
                </CommandDefinition>
            </CommandDefinitions>
            <RuleDefinitions>
                <TabDisplayRules />
                <DisplayRules>
                    <DisplayRule Id="Bee.DisplayRule.AllClients">
                        <CommandClientTypeRule Type="Modern" />
                        <CommandClientTypeRule Type="Refresh" />
                        <CommandClientTypeRule Type="Legacy" />
                    </DisplayRule>
                </DisplayRules>
                <EnableRules>
                    <EnableRule Id="Bee.EnableRule.SelectionCountOne">
                        <SelectionCountRule Minimum="1" Maximum="1" AppliesTo="SelectedEntity" />
                    </EnableRule>
                </EnableRules>
            </RuleDefinitions>
            <LocLabels />
        </RibbonDiffXml>
有帮助吗?

解决方案

I just apply one CommandClientTypeRule Type="Refresh", it works. Again apply all three types not working. All have different meanings as below.

Modern: The command bar is presented using Microsoft Dynamics CRM for tablets.

Refresh: The command bar is presented using the updated user interface.

Legacy: The ribbon is presented in forms for entities that were not updated or in a list view in Microsoft Dynamics CRM for Microsoft Office Outlook.

<DisplayRules>
  <DisplayRule Id="Bee.DisplayRule.AllClients">    
    <CommandClientTypeRule Type="Refresh" />    
  </DisplayRule>
</DisplayRules>

But Go to url button goes to overflow section means in the drop down hidden menu.

Displaying the button on command bar before NEW button apply some sequence, following is RibbonXml that show the button just before NEW button, when one record is selected.

<RibbonDiffXml>
  <CustomActions>
    <CustomAction Id="Bee.CustomAction.GoToUrl" Location="Mscrm.HomepageGrid.account.MainTab.Management.Controls._children"  Sequence="5">
      <CommandUIDefinition>
        <Button Id="Bee.HomepageGrid.account.GoToUrl"
                LabelText="Go To URL"
                ToolTipDescription="Description, Go to URL with selected account"
                ToolTipTitle="Title, Go to URL with selected account"
                Alt="Go to"
                Command="Bee.CommandDefinition.GoToUrl"
                Sequence="5" 
                TemplateAlias="o1" />
      </CommandUIDefinition>
    </CustomAction>
  </CustomActions>
  <Templates>
    <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
  </Templates>
  <CommandDefinitions>
    <CommandDefinition Id="Bee.CommandDefinition.GoToUrl">
      <EnableRules>
        <EnableRule Id="Bee.EnableRule.SelectionCountOne" />
      </EnableRules>
      <DisplayRules>
        <DisplayRule Id="Bee.DisplayRule.AllClients"/>
      </DisplayRules>
      <Actions>
        <Url Address="http://localhost/mysite" PassParams="true"></Url>
      </Actions>
    </CommandDefinition>
  </CommandDefinitions>
  <RuleDefinitions>
    <TabDisplayRules />
    <DisplayRules>
      <DisplayRule Id="Bee.DisplayRule.AllClients">
        <CommandClientTypeRule Type="Refresh" />
      </DisplayRule>
    </DisplayRules>
    <EnableRules>
      <EnableRule Id="Bee.EnableRule.SelectionCountOne">
        <SelectionCountRule Minimum="1" Maximum="1" AppliesTo="SelectedEntity" />
      </EnableRule>
    </EnableRules>
  </RuleDefinitions>
  <LocLabels/>
</RibbonDiffXml>

其他提示

I would suggest you to try Ribbon Workbench. You don't need to download/extract/modify/pack/import anymore. Everything is done directly from Dynamics CRM and without any knowledge of XML.

You should add LocLabels to your RibbonDiffXml. Attribute LabelText a.o. must hold references to these localized labels. They are not meant to hold the texts themselves.

Look on CodePlex for some fine ribbon editors; they will give you a good start!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top