MS Dynamics CRM 2011 :Ribbon Customization Part-1-Add a custom tab to Microsoft Dynamics CRM 2011 ribbon

If you need the basics on  Ribbon customization please check my earlier blog  MS Dynamics CRM 2011 :Ribbon Customization Part-1

Today  we will look at how to add a tab  and a custom button to the tab to the existing CRM 2011 ribbon

  1. Create a new Solution with the name ‘AddCustomTabSolution’
  2. Add the Exisitng’ApplicationRibbon’ to the above solution
  3. Save and Export the solution
  4. Unzip the Solution , Edit the Customization File.
  5. The open the customization file  it appears as below.  

<ImportExportXml xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”&gt;

 <Entities></Entities>

 <Roles></Roles>

  <Workflows></Workflows>

  <FieldSecurityProfiles></FieldSecurityProfiles>

  <Templates />

  <RibbonDiffXml>

    <CustomActions />

    <Templates>

      <RibbonTemplates Id=”Mscrm.Templates”></RibbonTemplates>

    </Templates>

    <CommandDefinitions />

    <RuleDefinitions>

      <TabDisplayRules />

      <DisplayRules />

      <EnableRules />

    </RuleDefinitions>

    <LocLabels />

  </RibbonDiffXml>

  <EntityMaps />

  <EntityRelationships />

  <OrganizationSettings />

  <optionsets />

  <Languages>

    <Language>1033</Language>

  </Languages>

</ImportExportXml>

6. Now our task is to add a Tab to the Ribbon . as from our earlier post we know that whatever we need to do(Add, Remove, Hide items) on the Ribbon we need to do under CustomActions

7. Adding a Custom Action By Specifying the CustomAction 

<CustomAction Id=”Mscrm.ISV.MyCustomTabAction” Location=”Mscrm.Tabs._children” Sequence=”1000″>
        <CommandUIDefinition>

          <Tab Id=”Mscrm.ISV.MyCustomTab” Command=”Mscrm.ISV.MyCustomTabCommand” Description=”Custom Tab” Title=”Custom Tab” Sequence=”1000″>

            <Scaling Id=”Mscrm.Isv.Global.Scaling”>

              <MaxSize Id=”Mscrm.Isv.Global.Group0.MaxSize” Sequence=”10″ GroupId=”Mscrm.Isv.Global.Group0″ Size=”Large” />

              <Scale Id=”Mscrm.Isv.Global.Group0.Scale.Medium” Sequence=”20″ GroupId=”Mscrm.Isv.Global.Group0″ Size=”Medium” />

              <Scale Id=”Mscrm.Isv.Global.Group0.Scale.Small” Sequence=”30″ GroupId=”Mscrm.Isv.Global.Group0″ Size=”Small” />

              <Scale Id=”Mscrm.Isv.Global.Group0.Scale.Popup” Sequence=”40″ GroupId=”Mscrm.Isv.Global.Group0″ Size=”Popup” />

            </Scaling>

            <Groups Id=”Mscrm.Isv.Global.Groups”>

              <Group Id=”Mscrm.Isv.Global.Group0″ Sequence=”10″ Command=”Mscrm.Isv.Global.Group0″ Title=”Custom Group1″ Description=”Custom Group1″ Template=”Mscrm.Templates.Flexible”>

              </Group>

            </Groups>

          </Tab>

        </CommandUIDefinition>

      </CustomAction>

8. Specify the Command Definition

<CommandDefinitions>

      <CommandDefinition Id=”Mscrm.ISV.MyCustomTabCommand”>

        <EnableRules />

        <DisplayRules>

          <DisplayRule Id=”Mscrm.ISV.MyCustomTabCommand” />

        </DisplayRules>

        <Actions />

      </CommandDefinition>

      <CommandDefinition Id=”Mscrm.Isv.Global.Group0″>

        <EnableRules />

        <DisplayRules />

        <Actions />

      </CommandDefinition>

      </CommandDefinitions>

9.   Specify the display Rule

<DisplayRule Id=”Mscrm.ISV.MyCustomTabAction”>

       <OrRule>

          <Or>

            <CrmClientTypeRule Type=”Web” />   

          </Or>

        </OrRule>

       </DisplayRule>

10.  Save the Customization file, Zip the Solution and import the Solution and Refresh the Web page you can see the Custom Tab with the Custom Button inside a Custom Group  and the ribbon now looks like as shown in the screenshot.

Adding a Custom Tab to MS CRM 2011



The entire customization file  can be Downloaded here .
Unmanaged Solution can be downloaded here

Advertisements