MS Dynamics CRM 2011 :Ribbon Customization Part-2-Understanding the Ribbon customization

Revisit my earlier post and dig in to the details of how we added a tab and also button to the tab.

  1.       As we need to Add a “Tab” , as we understood from the Post 1, any modifications to the ribbon definitions should be done at  <Custom Actions>
  2. See the picture below,<Custom Action> can contain <Custom Action> or <Hide Action>
    RibbonDiffXml Dynamics CRM 2011

    RibbonDiffXML

     

  3. <Custom Action> should have Id, Location ,Sequence, Title, CommandUIDefinition

So we added the following Custom Action

<CustomAction Id=Mscrm.Isv.GlobalCustomAction Location=Mscrm.Tabs._children Sequence=100>
 
 
 

 

4.  < CommandUIDefinition > can contain any  type (for ex: button,tab etc.,) what is displayed in the  above Screenshot. But we are interested to add Tab,So refer the screenshot for the Properties and the elements Tabtaype contains so we added the following < CommandUIDefinition >

< CommandUIDefinition >       

<Tab Id=”Mscrm.Isv.Global” Command=”Mscrm.Isv.Global” 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”>

                <Controls Id=”Mscrm.Isv.Global.Group0.Controls”>

                  <Button Id=”Mscrm.Isv.Global.Group0.Control0″ Command=”Mscrm.Isv.Global.Group0.Control0″ LabelText=”$LocLabels:Mscrm.Isv.Global.Group0.Control0.LocLabel” ToolTipTitle=”$LocLabels:Mscrm.Isv.Global.Group0.Control0.LocLabel” ToolTipDescription=”$LocLabels:Mscrm.Isv.Global.Group0.Control0.ToolTip.LocLabel” Image16by16=”/_imgs/area/18_home.gif” Image32by32=”/_imgs/area/18_home.gif” Image16by16Class=”ms-crm-Upgraded-Ribbon-Image16″ Image32by32Class=”ms-crm-Upgraded-Ribbon-Image32″ Sequence=”10″ TemplateAlias=”o1″ />

                </Controls>

              </Group>

            </Groups>

          </Tab>

        </CommandUIDefinition>

5.   After this we need to specify the <CommandDefinitions> which Specifies a set of rules that control how a ribbon element is displayed and actions to perform that can be referenced by ribbon elements and controls See the below screenshot for how the Command definition should be done

CommandDefinetion Dynamics CRM 2011 ribbon

CommandDefinetion Dynamics CRM 2011 ribbon

<CommandDefinitions>

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

        <EnableRules />

        <DisplayRules>

          <DisplayRule Id=”Mscrm.Isv.Global.Group0.Control0″ />

        </DisplayRules>

        <Actions>         

        </Actions>

      </CommandDefinition>

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

        <EnableRules />

        <DisplayRules>

          <DisplayRule Id=”Mscrm.Isv.Global” />

        </DisplayRules>

        <Actions />

      </CommandDefinition>

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

        <EnableRules />

        <DisplayRules />

        <Actions />

      </CommandDefinition>

    </CommandDefinitions>

6.  Then we need to add the  Rule definetions. Please check the below screenshot for the details how the Rule definitions should be configured so we added

Rule DefinetionGlobal Microsoft dynamics CRM 2011

<RuleDefinitions>

      <TabDisplayRules>

        <TabDisplayRule TabCommand=”Mscrm.Isv.Global”>

          <PageRule Address=”*” />

        </TabDisplayRule>

      </TabDisplayRules>

      <DisplayRules>

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

           <OrRule>

            <Or>

              <CrmClientTypeRule Type=”Web” />

            </Or>

           </OrRule>

        </DisplayRule>

        <DisplayRule Id=”Mscrm.Isv.Global.Group0.Control0″>

          <CrmOfflineAccessStateRule State=”Offline” InvertResult=”true” />

        </DisplayRule>

      </DisplayRules>

      <EnableRules />

    </RuleDefinitions>

7.  At the End we have added thee Lockables where you can specify the text to display in the ribbon labels and tooltips

<LocLabel Id=”Mscrm.Isv.Global.Group0.Control0.LocLabel”>

        <Titles>

          <Title languagecode=”1033″ description=”Custom Button” />

        </Titles>

      </LocLabel>

      <LocLabel Id=”Mscrm.Isv.Global.Group0.Control0.ToolTip.LocLabel”>

        <Titles>

          <Title languagecode=”1033″ description=”Custom Button” />

        </Titles>

      </LocLabel>

    </LocLabels>

Advertisements

2 Responses to MS Dynamics CRM 2011 :Ribbon Customization Part-2-Understanding the Ribbon customization

  1. Pingback: Ribbon Customization-Part 3-Add a Custom Tab to a Specific Entity(Opportunity Entity) « Siva's Dynamics CRM 2011 Blog

  2. Pingback: Dynamics CRM 2011 Ribbon Customization Index « Siva's Dynamics CRM 2011 Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: