Export (0) Print
Expand All

Walkthrough: Add a Custom Group to an Existing Tab for a Specific Entity

[Applies to: Microsoft Dynamics CRM 2011]

This walkthrough describes how to add a custom group that has three custom buttons to the main tab for the Contact entity. The procedure to add a custom group that has controls to any tab or any entity will be similar.

TipTip
A managed solution that includes the goal of this walkthrough is available in the Microsoft Dynamics CRM SDK download at SDK\Walkthroughs\Ribbon\AddaCustomGrouptoanExistingTabforaSpecificEntity.zip.

Because it is a managed solution, you can install (import) it to view the customized ribbon. You can then uninstall (delete) it to remove it from your system.

If you install this managed solution, make sure that you uninstall it before you try the walkthrough steps.

Before you begin, you must have a clear set of requirements. The following images describe the goal:

Contact entity form ribbon

A custom group for the Contact entity Form

Three custom buttons in a custom group in the form ribbon.

Contact entity form ribbon with popup

A custom group for the contact entity form popup

When the width of the form is decreased, the layout of the three custom buttons changes to the popup layout.

Contact entity grid ribbon

Custom group for Contact entity grid

The same three buttons appear in the grid ribbon.

Contact entity grid ribbon with popup

Custom group for Contact entity grid with popup

When the width of the grid is decreased, the layout of the three custom buttons changes to the popup layout.

The following are the requirements for the custom group that will be met in this example:

  1. Will appear only for the Contact entity.

  2. Will appear between the Records and Collaborate group in the contact grid.

  3. Will appear between the Save and Collaborate group in the contact form.

  4. Will only appear in the Web client.

  5. On the contact form, this custom group will only be enabled when a new record has been saved.

  6. On the contact grid, this custom group will only be enabled when a single contact record is selected.

  7. Will have the label Custom Group.

  8. Will be defined separately for the form and grid ribbons. Web resources will be used to provide the icons for each button. The following table lists the properties that each of the buttons will have.

     

    Area Icon Id Label ToolTip Action

    Form

    A 16x16 pixel icon displaying the letter A

    sample_/icons/AIcon16x16.png

    A 32x32 pixel icon displaying the letter A

    sample_/icons/AIcon32x32.png

    Sample.contact.form.CustomGroup.Button.A

    Button A Label

    Button A Label

    Button A Description

    Display message "Button A action performed."

    A 16x16 pixel icon displaying the letter B

    sample_/icons/BIcon16x16.png

    A 32x32 pixel icon displaying the letter B

    sample_/icons/BIcon32x32.png

    Sample.contact.form.CustomGroup.Button.B

    Button B Label

    Button B Label

    Button B Description

    Display message "Button B action performed."

    A 16x16 pixel icon displaying the letter C

    sample_/icons/CIcon16x16.png

    A 32x32 pixel icon displaying the letter C

    sample_/icons/CIcon32x32.png

    Sample.contact.form.CustomGroup.Button.C

    Button C Label

    Button C Label

    Button C Description

    Display message "Button C action performed."

    Grid

    A 16x16 pixel icon displaying the letter A

    sample_/icons/AIcon16x16.png

    A 32x32 pixel icon displaying the letter A

    sample_/icons/AIcon32x32.png

    Sample.contact.grid.CustomGroup.Button.A

    Button A Label

    Button A Label

    Button A Description

    Display message "Button A action performed."

    A 16x16 pixel icon displaying the letter B

    sample_/icons/BIcon16x16.png

    A 32x32 pixel icon displaying the letter B

    sample_/icons/BIcon32x32.png

    Sample.contact.grid.CustomGroup.Button.B

    Button B Label

    Button B Label

    Button B Description

    Display message "Button B action performed."

    A 16x16 pixel icon displaying the letter C

    sample_/icons/CIcon16x16.png

    A 32x32 pixel icon displaying the letter C

    sample_/icons/CIcon32x32.png

    Sample.contact.grid.CustomGroup.Button.C

    Button C Label

    Button C Label

    Button C Description

    Display message "Button C action performed."



    TipTip
    You can import the Microsoft Dynamics CRM SDK sample images managed solution to add these icons to your organization. The solution is available in the downloadable files for the SDK at SDK\Walkthroughs\Ribbon\MicrosoftCRMSDKSampleImages.zip.

  9. When the group is scaled to be displayed as a popup, an icon displaying the letter "T" will be displayed.

    A 32x32 pixel icon displaying the letter T
    sample_/icons/TIcon32x32.png

noteNote
This walkthrough does not show how the controls in the group should be correctly scaled by using the <Scale> (RibbonDiffXml) element. The <Scaling> (RibbonDiffXml) elements <MaxSize> (RibbonDiffXml) and <Scale> (RibbonDiffXml) with Size="Popup" are presented in this walkthrough. Proper scaling would allow for gradual re-sizing of elements as the available width changes.

  1. By exporting and making changes only to the ribbon for the Contact entity, you will meet requirement 1.

    You may export the complete default solution, including the Contact entity, but in order to minimize the total file size, we recommend that you create a new solution and add the Contact entity to it.

    Create a New Solution

  2. Export the Solution

  1. Examples of the RibbonXml definitions for entities are available in the SDK download package at SDK\Resources\ExportedRibbonXml. The contactRibbon.xml file defines the ribbon for the Contact entity.

    In step 8 you will need to create a <CustomAction> (RibbonDiffXml) element and set the Location attribute so that your new group will be included with the existing groups. You need the Id of the <Groups> (RibbonDiffXml) element. Open the contactRibbon.xml file and note the Id values for the <Groups> (RibbonDiffXml) element:

    • <Groups Id="Mscrm.Form.contact.MainTab.Groups">

    • <Groups Id="Mscrm.HomepageGrid.contact.MainTab.Groups">

  2. Requirements 2 and 3 are about where the group will appear relative to other groups. The relative location is determined by the Sequence attribute value for the groups. Review the existing <Group> (RibbonDiffXml) elements and note the Sequence value for the Collaborate group in both the contact form and contact grid:

    Form Collaborate Group
    <Group Id="Mscrm.Form.contact.MainTab.Collaborate"
            Command="Mscrm.Enabled"
            Sequence="40"
            Title="$Resources:Ribbon.HomepageGrid.MainTab.Collaborate"
            Image32by32Popup="/_imgs/ribbon/assign32.png"
            Template="Mscrm.Templates.Flexible2">
    
    
    Grid Collaborate Group
    <Group Id="Mscrm.HomepageGrid.contact.MainTab.Collaborate"
            Command="Mscrm.Enabled"
            Sequence="30"
            Title="$Resources:Ribbon.HomepageGrid.MainTab.Collaborate"
            Image32by32Popup="/_imgs/ribbon/assign32.png"
            Template="Mscrm.Templates.Flexible2">
    
    

    Set the Sequence value of the <Group> (RibbonDiffXml) elements that you create to 39 and 29 so that they appear to the left of the Collaborate group.

  1. Create a script Web resource named ‘sample_ShowMessage.js’.

    noteNote
    The full name of the script Web resource you create depends on the solution it is created in. For this sample, the solution publisher customization prefix is ‘sample’. The default solution publisher prefix is ‘new’. You may have to change how you reference the name of this Web resource in the example XML if the name of the script Web resource you use is different.

    For more information, see Script (JScript) Web Resources and JScript Libraries for Microsoft Dynamics CRM.

  2. Set the source of this Web resource as shown in the following example:

    function show(letter)
    {
    alert("Button "+letter+" action performed.");
    }
    
  3. Save and publish the script Web resource.

  1. Extract the compressed solutions file.

  2. Open the customizations.xml file.

    TipTip
    Although you can edit the customization.xml file by using any text editor, we recommend that you use Microsoft Visual Studio or another XML editing application that supports XSD schema validation. This will help avoid XML validation errors when you import the ribbon.

    Associate the customizations.xml file with the customizationsSolution.xsd file. You can find this schema in the SDK\Schemas\CustomizationsSolution.xsd file in the SDK download package.

    For more information, see Prepare to edit the XML

  3. Locate the default RibbonDiffXml node as shown in the following example:

    <RibbonDiffXml>
      <CustomActions />
      <Templates>
        <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
      </Templates>
      <CommandDefinitions />
      <RuleDefinitions>
        <TabDisplayRules />
        <DisplayRules />
        <EnableRules />
      </RuleDefinitions>
      <LocLabels />
    </RibbonDiffXml>
    
    
  4. Edit the <RuleDefinitions> (RibbonDiffXml) node to define display and enable rules to support requirements 4, 5, and 6.

    For more information, see Define Ribbon Enable Rules and Define Ribbon Display Rules.

    <RuleDefinitions>
      <TabDisplayRules />
      <DisplayRules>
        <DisplayRule Id="Sample.contact.WebClient.DisplayRule">
          <CrmClientTypeRule Type="Web" />
        </DisplayRule>
        <DisplayRule Id="Sample.contact.form.FormStateNotNew.DisplayRule">
          <FormStateRule State="Create"
                          InvertResult="true" />
        </DisplayRule>
      </DisplayRules>
      <EnableRules>
        <EnableRule Id="Sample.contact.grid.OneSelected.EnableRule">
          <SelectionCountRule AppliesTo="SelectedEntity"
                              Maximum="1"
                              Minimum="1" />
        </EnableRule>
        <EnableRule Id="Sample.contact.form.NotNew.EnableRule">
          <FormStateRule State="Create"
                          InvertResult="true" />
        </EnableRule>
        <EnableRule Id="Sample.contact.WebClient.EnableRule">
          <CrmClientTypeRule Type="Web" />
        </EnableRule>
      </EnableRules>
    </RuleDefinitions>
    
    
  5. Edit the <LocLabels> (RibbonDiffXml) node to set the localized labels for requirements 7 and 8, as shown in the following example. For more information, see Use Localized Labels with Ribbons.

    <LocLabels>
      <LocLabel Id="Sample.contact.CustomGroup.Button.B.LabelText">
        <Titles>
          <Title languagecode="1033"
                  description="Button B Label" />
        </Titles>
      </LocLabel>
      <LocLabel Id="Sample.contact.CustomGroup.Button.B.Description">
        <Titles>
          <Title languagecode="1033"
                  description="Button B Description" />
        </Titles>
      </LocLabel>
      <LocLabel Id="Sample.contact.CustomGroup.Button.C.LabelText">
        <Titles>
          <Title languagecode="1033"
                  description="Button C Label" />
        </Titles>
      </LocLabel>
      <LocLabel Id="Sample.contact.CustomGroup.Button.A.LabelText">
        <Titles>
          <Title languagecode="1033"
                  description="Button A Label" />
        </Titles>
      </LocLabel>
      <LocLabel Id="Sample.contact.CustomGroup.Button.C.Description">
        <Titles>
          <Title languagecode="1033"
                  description="Button C Description" />
        </Titles>
      </LocLabel>
      <LocLabel Id="Sample.contact.CustomGroup.Button.A.Description">
        <Titles>
          <Title languagecode="1033"
                  description="Button A Description" />
        </Titles>
      </LocLabel>
      <LocLabel Id="Sample.contact.CustomGroup.Title">
        <Titles>
          <Title languagecode="1033"
                  description="Custom Group" />
        </Titles>
      </LocLabel>
    </LocLabels>
    
    
  6. Edit the <CommandDefinitions> (RibbonDiffXml) node to add five commands.

    Each <CommandDefinition> (RibbonDiffXml) consolidates a set of enable rules, display rules, and actions associated with a control. In this example. you use commands associated with each custom group to control whether the button controls displayed in the custom group will be displayed. Therefore, the command definitions for the custom groups will contain enable and display rules. Commands for each button control will only contain definitions for actions.

    Because the custom group will be displayed on both the form and the grid, separate commands in the following example allow for clearly defining the expected behavior in each location:

    <CommandDefinitions>
        
      <CommandDefinition Id="Sample.contact.grid.CustomGroup.Command">
        <EnableRules>
          <EnableRule Id="Sample.contact.grid.OneSelected.EnableRule" />
        </EnableRules>
        <DisplayRules>
          <DisplayRule Id="Sample.contact.WebClient.DisplayRule" />
        </DisplayRules>
        <Actions />
      </CommandDefinition>
        
      <CommandDefinition Id="Sample.contact.form.CustomGroup.Command">
        <EnableRules>
          <EnableRule Id="Sample.contact.form.NotNew.EnableRule" />
        </EnableRules>
        <DisplayRules>
          <DisplayRule Id="Sample.contact.WebClient.DisplayRule" />
        </DisplayRules>
        <Actions />
      </CommandDefinition>
    
      <CommandDefinition Id="Sample.contact.CustomGroup.Button.A.Command">
        <EnableRules />
        <DisplayRules />
        <Actions>
          <JavaScriptFunction Library="$webresource:sample_ShowMessage.js"
                              FunctionName="show">
            <StringParameter Value="A" />
          </JavaScriptFunction>
        </Actions>
      </CommandDefinition>
        
      <CommandDefinition Id="Sample.contact.CustomGroup.Button.B.Command">
        <EnableRules />
        <DisplayRules />
        <Actions>
          <JavaScriptFunction Library="$webresource:sample_ShowMessage.js"
                              FunctionName="show">
            <StringParameter Value="B" />
          </JavaScriptFunction>
        </Actions>
      </CommandDefinition>
        
      <CommandDefinition Id="Sample.contact.CustomGroup.Button.C.Command">
        <EnableRules />
        <DisplayRules />
        <Actions>
          <JavaScriptFunction Library="$webresource:sample_ShowMessage.js"
                              FunctionName="show">
            <StringParameter Value="C" />
          </JavaScriptFunction>
        </Actions>
      </CommandDefinition>
        
    </CommandDefinitions>
    
    
  7. Review the contactRibbon.xml file to see how the contact form Collaborate group uses <GroupTemplate> (RibbonDiffXml)Mscrm.Templates.Flexible2. Note that TemplateAlias="isv" provides a template alias you can use.

    noteNote
    You can define your own custom group templates to specify exactly how you want the controls in a custom group to re-size themselves. However, for the purposes of the following example use an existing group template:

    <GroupTemplate Id="Mscrm.Templates.Flexible2">
      <Layout Title="LargeLarge">
        <OverflowSection Type="OneRow"
                          TemplateAlias="o1"
                          DisplayMode="Large" />
        <OverflowSection Type="OneRow"
                          TemplateAlias="o2"
                          DisplayMode="Large" />
        <OverflowSection Type="OneRow"
                          TemplateAlias="isv"
                          DisplayMode="Large" />
      </Layout>
      <Layout Title="LargeMedium">
        <OverflowSection Type="OneRow"
                          TemplateAlias="o1"
                          DisplayMode="Large" />
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="o2"
                          DisplayMode="Medium" />
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="isv"
                          DisplayMode="Medium" />
      </Layout>
      <Layout Title="MediumMedium">
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="o1"
                          DisplayMode="Medium" />
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="o2"
                          DisplayMode="Medium" />
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="isv"
                          DisplayMode="Medium" />
      </Layout>
      <Layout Title="MediumSmall">
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="o1"
                          DisplayMode="Medium" />
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="o2"
                          DisplayMode="Small" />
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="isv"
                          DisplayMode="Medium" />
      </Layout>
      <Layout Title="LargeSmall">
        <OverflowSection Type="OneRow"
                          TemplateAlias="o1"
                          DisplayMode="Large" />
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="o2"
                          DisplayMode="Small" />
        <OverflowSection Type="ThreeRow"
                          TemplateAlias="isv"
                          DisplayMode="Small" />
      </Layout>
      <Layout Title="Popup"
              LayoutTitle="LargeMedium" />
    </GroupTemplate>
    
    
  8. Edit the <CustomActions> (RibbonDiffXml) element to add <CustomAction> (RibbonDiffXml) elements that define a <CommandUIDefinition> (RibbonDiffXml) element for:


    Use the Id values that you gathered in steps 1 and 2 by using the contactRibbon.xml to set the Location and Sequence attributes to control where these groups will be displayed relative to the other groups of tab as shown in the following example:

    <CustomActions>
    
      <CustomAction Id="Sample.contact.grid.CustomGroup.Popup.CustomAction"
                    Location="Mscrm.HomepageGrid.contact.MainTab.Scaling._children"
                    Sequence="160">
        <CommandUIDefinition>
          <Scale Id="Sample.contact.grid.CustomGroup.Popup.1"
                  GroupId="Sample.contact.grid.CustomGroup.Group"
                  Sequence="85"
                  Size="Popup" />
        </CommandUIDefinition>
      </CustomAction>
    
      <CustomAction Id="Sample.contact.form.CustomGroup.MaxSize.CustomAction"
                    Location="Mscrm.Form.contact.MainTab.Scaling._children"
                    Sequence="120">
        <CommandUIDefinition>
          <MaxSize Id="Sample.contact.form.CustomGroup.MaxSize"
                    GroupId="Sample.contact.form.CustomGroup.Group"
                    Sequence="21"
                    Size="LargeLarge" />
        </CommandUIDefinition>
      </CustomAction>
    
      <CustomAction Id="Sample.contact.form.CustomGroup.CustomAction"
                    Location="Mscrm.Form.contact.MainTab.Groups._children"
                    Sequence="110">
        <CommandUIDefinition>
          <Group Id="Sample.contact.form.CustomGroup.Group"
                  Command="Sample.contact.form.CustomGroup.Command"
                  Title="$LocLabels:Sample.contact.CustomGroup.Title"
                  Sequence="39"
                  Template="Mscrm.Templates.Flexible2"
                  Image32by32Popup="$webresource:sample_/icons/TIcon32x32.png">
            <Controls Id="Sample.contact.form.CustomGroup.Controls">
              <Button Id="Sample.contact.form.CustomGroup.Button.A"
                      Command="Sample.contact.CustomGroup.Button.A.Command"
                      Sequence="10"
                      LabelText="$LocLabels:Sample.contact.CustomGroup.Button.A.LabelText"
                      ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.A.LabelText"
                      ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.A.Description"
                      TemplateAlias="isv"
                      Image16by16="$webresource:sample_/icons/AIcon16x16.png"
                      Image32by32="$webresource:sample_/icons/AIcon32x32.png" />
              <Button Id="Sample.contact.form.CustomGroup.Button.B"
                      Command="Sample.contact.CustomGroup.Button.B.Command"
                      Sequence="20"
                      LabelText="$LocLabels:Sample.contact.CustomGroup.Button.B.LabelText"
                      ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.B.LabelText"
                      ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.B.Description"
                      TemplateAlias="isv"
                      Image16by16="$webresource:sample_/icons/BIcon16x16.png"
                      Image32by32="$webresource:sample_/icons/BIcon32x32.png" />
              <Button Id="Sample.contact.form.CustomGroup.Button.C"
                      Command="Sample.contact.CustomGroup.Button.C.Command"
                      Sequence="30"
                      LabelText="$LocLabels:Sample.contact.CustomGroup.Button.C.LabelText"
                      ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.C.LabelText"
                      ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.C.Description"
                      TemplateAlias="isv"
                      Image16by16="$webresource:sample_/icons/CIcon16x16.png"
                      Image32by32="$webresource:sample_/icons/CIcon32x32.png" />
            </Controls>
          </Group>
        </CommandUIDefinition>
      </CustomAction>
    
      <CustomAction Id="Sample.contact.form.CustomGroup.Popup.CustomAction"
                    Location="Mscrm.Form.contact.MainTab.Scaling._children"
                    Sequence="140">
        <CommandUIDefinition>
          <Scale Id="Sample.contact.form.CustomGroup.Popup.1"
                  GroupId="Sample.contact.form.CustomGroup.Group"
                  Sequence="85"
                  Size="Popup" />
        </CommandUIDefinition>
      </CustomAction>
    
      <CustomAction Id="Sample.contact.grid.CustomGroup.CustomAction"
                    Location="Mscrm.HomepageGrid.contact.MainTab.Groups._children"
                    Sequence="140">
        <CommandUIDefinition>
          <Group Id="Sample.contact.grid.CustomGroup.Group"
                  Command="Sample.contact.grid.CustomGroup.Command"
                  Title="$LocLabels:Sample.contact.CustomGroup.Title"
                  Sequence="29"
                  Template="Mscrm.Templates.Flexible2"
                  Image32by32Popup="$webresource:sample_/icons/TIcon32x32.png">
            <Controls Id="Sample.contact.grid.CustomGroup.Controls">
              <Button Id="Sample.contact.grid.CustomGroup.Button.A"
                      Command="Sample.contact.CustomGroup.Button.A.Command"
                      Sequence="10"
                      LabelText="$LocLabels:Sample.contact.CustomGroup.Button.A.LabelText"
                      ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.A.LabelText"
                      ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.A.Description"
                      TemplateAlias="isv"
                      Image16by16="$webresource:sample_/icons/AIcon16x16.png"
                      Image32by32="$webresource:sample_/icons/AIcon32x32.png" />
              <Button Id="Sample.contact.grid.CustomGroup.Button.B"
                      Command="Sample.contact.CustomGroup.Button.B.Command"
                      Sequence="20"
                      LabelText="$LocLabels:Sample.contact.CustomGroup.Button.B.LabelText"
                      ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.B.LabelText"
                      ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.B.Description"
                      TemplateAlias="isv"
                      Image16by16="$webresource:sample_/icons/BIcon16x16.png"
                      Image32by32="$webresource:sample_/icons/BIcon32x32.png" />
              <Button Id="Sample.contact.grid.CustomGroup.Button.C"
                      Command="Sample.contact.CustomGroup.Button.C.Command"
                      Sequence="30"
                      LabelText="$LocLabels:Sample.contact.CustomGroup.Button.C.LabelText"
                      ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.C.LabelText"
                      ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.C.Description"
                      TemplateAlias="isv"
                      Image16by16="$webresource:sample_/icons/CIcon16x16.png"
                      Image32by32="$webresource:sample_/icons/CIcon32x32.png" />
            </Controls>
          </Group>
        </CommandUIDefinition>
      </CustomAction>
    
      <CustomAction Id="Sample.contact.grid.CustomGroup.MaxSize.CustomAction"
                    Location="Mscrm.HomepageGrid.contact.MainTab.Scaling._children"
                    Sequence="150">
        <CommandUIDefinition>
          <MaxSize Id="Sample.contact.grid.CustomGroup.MaxSize"
                    GroupId="Sample.contact.grid.CustomGroup.Group"
                    Sequence="21"
                    Size="LargeLarge" />
        </CommandUIDefinition>
      </CustomAction>
    
    </CustomActions>
    
    
    
  9. Your final modified RibbonDiffXml node will look like the following example:

    <RibbonDiffXml>
      <CustomActions>
    
        <CustomAction Id="Sample.contact.grid.CustomGroup.Popup.CustomAction"
                      Location="Mscrm.HomepageGrid.contact.MainTab.Scaling._children"
                      Sequence="160">
          <CommandUIDefinition>
            <Scale Id="Sample.contact.grid.CustomGroup.Popup.1"
                    GroupId="Sample.contact.grid.CustomGroup.Group"
                    Sequence="85"
                    Size="Popup" />
          </CommandUIDefinition>
        </CustomAction>
    
        <CustomAction Id="Sample.contact.form.CustomGroup.MaxSize.CustomAction"
                      Location="Mscrm.Form.contact.MainTab.Scaling._children"
                      Sequence="120">
          <CommandUIDefinition>
            <MaxSize Id="Sample.contact.form.CustomGroup.MaxSize"
                      GroupId="Sample.contact.form.CustomGroup.Group"
                      Sequence="21"
                      Size="LargeLarge" />
          </CommandUIDefinition>
        </CustomAction>
    
        <CustomAction Id="Sample.contact.form.CustomGroup.CustomAction"
                      Location="Mscrm.Form.contact.MainTab.Groups._children"
                      Sequence="110">
          <CommandUIDefinition>
            <Group Id="Sample.contact.form.CustomGroup.Group"
                    Command="Sample.contact.form.CustomGroup.Command"
                    Title="$LocLabels:Sample.contact.CustomGroup.Title"
                    Sequence="39"
                    Template="Mscrm.Templates.Flexible2"
                    Image32by32Popup="$webresource:sample_/icons/TIcon32x32.png">
              <Controls Id="Sample.contact.form.CustomGroup.Controls">
                <Button Id="Sample.contact.form.CustomGroup.Button.A"
                        Command="Sample.contact.CustomGroup.Button.A.Command"
                        Sequence="10"
                        LabelText="$LocLabels:Sample.contact.CustomGroup.Button.A.LabelText"
                        ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.A.LabelText"
                        ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.A.Description"
                        TemplateAlias="isv"
                        Image16by16="$webresource:sample_/icons/AIcon16x16.png"
                        Image32by32="$webresource:sample_/icons/AIcon32x32.png" />
                <Button Id="Sample.contact.form.CustomGroup.Button.B"
                        Command="Sample.contact.CustomGroup.Button.B.Command"
                        Sequence="20"
                        LabelText="$LocLabels:Sample.contact.CustomGroup.Button.B.LabelText"
                        ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.B.LabelText"
                        ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.B.Description"
                        TemplateAlias="isv"
                        Image16by16="$webresource:sample_/icons/BIcon16x16.png"
                        Image32by32="$webresource:sample_/icons/BIcon32x32.png" />
                <Button Id="Sample.contact.form.CustomGroup.Button.C"
                        Command="Sample.contact.CustomGroup.Button.C.Command"
                        Sequence="30"
                        LabelText="$LocLabels:Sample.contact.CustomGroup.Button.C.LabelText"
                        ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.C.LabelText"
                        ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.C.Description"
                        TemplateAlias="isv"
                        Image16by16="$webresource:sample_/icons/CIcon16x16.png"
                        Image32by32="$webresource:sample_/icons/CIcon32x32.png" />
              </Controls>
            </Group>
          </CommandUIDefinition>
        </CustomAction>
    
        <CustomAction Id="Sample.contact.form.CustomGroup.Popup.CustomAction"
                      Location="Mscrm.Form.contact.MainTab.Scaling._children"
                      Sequence="140">
          <CommandUIDefinition>
            <Scale Id="Sample.contact.form.CustomGroup.Popup.1"
                    GroupId="Sample.contact.form.CustomGroup.Group"
                    Sequence="85"
                    Size="Popup" />
          </CommandUIDefinition>
        </CustomAction>
    
        <CustomAction Id="Sample.contact.grid.CustomGroup.CustomAction"
                      Location="Mscrm.HomepageGrid.contact.MainTab.Groups._children"
                      Sequence="140">
          <CommandUIDefinition>
            <Group Id="Sample.contact.grid.CustomGroup.Group"
                    Command="Sample.contact.grid.CustomGroup.Command"
                    Title="$LocLabels:Sample.contact.CustomGroup.Title"
                    Sequence="29"
                    Template="Mscrm.Templates.Flexible2"
                    Image32by32Popup="$webresource:sample_/icons/TIcon32x32.png">
              <Controls Id="Sample.contact.grid.CustomGroup.Controls">
                <Button Id="Sample.contact.grid.CustomGroup.Button.A"
                        Command="Sample.contact.CustomGroup.Button.A.Command"
                        Sequence="10"
                        LabelText="$LocLabels:Sample.contact.CustomGroup.Button.A.LabelText"
                        ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.A.LabelText"
                        ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.A.Description"
                        TemplateAlias="isv"
                        Image16by16="$webresource:sample_/icons/AIcon16x16.png"
                        Image32by32="$webresource:sample_/icons/AIcon32x32.png" />
                <Button Id="Sample.contact.grid.CustomGroup.Button.B"
                        Command="Sample.contact.CustomGroup.Button.B.Command"
                        Sequence="20"
                        LabelText="$LocLabels:Sample.contact.CustomGroup.Button.B.LabelText"
                        ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.B.LabelText"
                        ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.B.Description"
                        TemplateAlias="isv"
                        Image16by16="$webresource:sample_/icons/BIcon16x16.png"
                        Image32by32="$webresource:sample_/icons/BIcon32x32.png" />
                <Button Id="Sample.contact.grid.CustomGroup.Button.C"
                        Command="Sample.contact.CustomGroup.Button.C.Command"
                        Sequence="30"
                        LabelText="$LocLabels:Sample.contact.CustomGroup.Button.C.LabelText"
                        ToolTipTitle="$LocLabels:Sample.contact.CustomGroup.Button.C.LabelText"
                        ToolTipDescription="$LocLabels:Sample.contact.CustomGroup.Button.C.Description"
                        TemplateAlias="isv"
                        Image16by16="$webresource:sample_/icons/CIcon16x16.png"
                        Image32by32="$webresource:sample_/icons/CIcon32x32.png" />
              </Controls>
            </Group>
          </CommandUIDefinition>
        </CustomAction>
    
        <CustomAction Id="Sample.contact.grid.CustomGroup.MaxSize.CustomAction"
                      Location="Mscrm.HomepageGrid.contact.MainTab.Scaling._children"
                      Sequence="150">
          <CommandUIDefinition>
            <MaxSize Id="Sample.contact.grid.CustomGroup.MaxSize"
                      GroupId="Sample.contact.grid.CustomGroup.Group"
                      Sequence="21"
                      Size="LargeLarge" />
          </CommandUIDefinition>
        </CustomAction>
    
      </CustomActions>
      <Templates>
        <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
      </Templates>
      <CommandDefinitions>
        <CommandDefinition Id="Sample.contact.CustomGroup.Button.A.Command">
          <EnableRules />
          <DisplayRules />
          <Actions>
            <JavaScriptFunction Library="$webresource:sample_ShowMessage.js"
                                FunctionName="show">
              <StringParameter Value="A" />
            </JavaScriptFunction>
          </Actions>
        </CommandDefinition>
        <CommandDefinition Id="Sample.contact.CustomGroup.Button.B.Command">
          <EnableRules />
          <DisplayRules />
          <Actions>
            <JavaScriptFunction Library="$webresource:sample_ShowMessage.js"
                                FunctionName="show">
              <StringParameter Value="B" />
            </JavaScriptFunction>
          </Actions>
        </CommandDefinition>
        <CommandDefinition Id="Sample.contact.CustomGroup.Button.C.Command">
          <EnableRules />
          <DisplayRules />
          <Actions>
            <JavaScriptFunction Library="$webresource:sample_ShowMessage.js"
                                FunctionName="show">
              <StringParameter Value="C" />
            </JavaScriptFunction>
          </Actions>
        </CommandDefinition>
        <CommandDefinition Id="Sample.contact.grid.CustomGroup.Command">
          <EnableRules>
            <EnableRule Id="Sample.contact.grid.OneSelected.EnableRule" />
          </EnableRules>
          <DisplayRules>
            <DisplayRule Id="Sample.contact.WebClient.DisplayRule" />
          </DisplayRules>
          <Actions />
        </CommandDefinition>
        <CommandDefinition Id="Sample.contact.form.CustomGroup.Command">
          <EnableRules>
            <EnableRule Id="Sample.contact.form.NotNew.EnableRule" />
          </EnableRules>
          <DisplayRules>
            <DisplayRule Id="Sample.contact.WebClient.DisplayRule" />
          </DisplayRules>
          <Actions />
        </CommandDefinition>
      </CommandDefinitions>
      <RuleDefinitions>
        <TabDisplayRules />
        <DisplayRules>
          <DisplayRule Id="Sample.contact.WebClient.DisplayRule">
            <CrmClientTypeRule Type="Web" />
          </DisplayRule>
          <DisplayRule Id="Sample.contact.form.FormStateNotNew.DisplayRule">
            <FormStateRule State="Create"
                            InvertResult="true" />
          </DisplayRule>
        </DisplayRules>
        <EnableRules>
          <EnableRule Id="Sample.contact.WebClient.EnableRule">
            <CrmClientTypeRule Type="Web" />
          </EnableRule>
          <EnableRule Id="Sample.contact.grid.OneSelected.EnableRule">
            <SelectionCountRule AppliesTo="SelectedEntity"
                                Maximum="1"
                                Minimum="1" />
          </EnableRule>
          <EnableRule Id="Sample.contact.form.NotNew.EnableRule">
            <FormStateRule State="Create"
                            InvertResult="true" />
          </EnableRule>
        </EnableRules>
      </RuleDefinitions>
      <LocLabels>
        <LocLabel Id="Sample.contact.CustomGroup.Button.C.LabelText">
          <Titles>
            <Title languagecode="1033"
                    description="Button C Label" />
          </Titles>
        </LocLabel>
        <LocLabel Id="Sample.contact.CustomGroup.Button.C.Description">
          <Titles>
            <Title languagecode="1033"
                    description="Button C Description" />
          </Titles>
        </LocLabel>
        <LocLabel Id="Sample.contact.CustomGroup.Button.A.Description">
          <Titles>
            <Title languagecode="1033"
                    description="Button A Description" />
          </Titles>
        </LocLabel>
        <LocLabel Id="Sample.contact.CustomGroup.Button.B.Description">
          <Titles>
            <Title languagecode="1033"
                    description="Button B Description" />
          </Titles>
        </LocLabel>
        <LocLabel Id="Sample.contact.CustomGroup.Button.B.LabelText">
          <Titles>
            <Title languagecode="1033"
                    description="Button B Label" />
          </Titles>
        </LocLabel>
        <LocLabel Id="Sample.contact.CustomGroup.Button.A.LabelText">
          <Titles>
            <Title languagecode="1033"
                    description="Button A Label" />
          </Titles>
        </LocLabel>
        <LocLabel Id="Sample.contact.CustomGroup.Title">
          <Titles>
            <Title languagecode="1033"
                    description="Custom Group" />
          </Titles>
        </LocLabel>
      </LocLabels>
    </RibbonDiffXml>
    
    

  1. Open Microsoft Dynamics CRM and view the Contacts sub area of the Navigation Pane.

  2. Verify the following:

    • The Custom Group group is displayed between the Records and the Collaborate groups on the Contacts tab.

    • All the buttons in the Custom Group become disabled when more than one contact record is selected in the grid.

    • The expected tooltip text is displayed when you place the pointer over each button.

    • The expected message is displayed when you click the button.

    • When you reduce the width of the page, the group scales to display the popup layout.

  3. Click the New button to start to create a new contact record and confirm that the buttons in the Custom group are disabled until you save the record.

  4. Verify the following in the form ribbon:

    • The Custom Group is displayed between the Save group and the Collaborate group.

    • The expected tooltip text is displayed when you place the pointer over the buttons.

    • The expected message is displayed when you click the buttons.

    • When you reduce the width of the form, the group scales to display the popup layout.

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.

Community Additions

Show:
© 2014 Microsoft