Tuesday, September 20, 2011

Adding New Group to Ribbon in CRM 2011

we have seen adding a button and renaming buttons in my previous posts. Now i am going to add a new group to the Ribbon.
Default Account Ribbon at Form Level.
After Adding New Group to Account Ribbon

1. Export the Solution to customize. And open the Customization.XML file for editing.(solution must contain sitemap)
2. Open Account RibbonDiffXml ribbon definition and then edit with the following logic
source code for the sample

 <RibbonDiffXml>
        <CustomActions>
          <CustomAction Id="Sample.account.form.CustomGroup.CustomAction" Location="Mscrm.Form.account.MainTab.Groups._children" Sequence="61">
            <CommandUIDefinition>
              <Group Id="Sample.account.form.CustomGroup.Group" Command="Sample.account.form.CustomGroup.Command" Title="Custom Group" Sequence="11" Template="Mscrm.Templates.Flexible2" Image32by32Popup="/_imgs/Workplace/remove_32.png">
                <Controls Id="Sample.account.form.CustomGroup.Controls">
                  <Button Id="Sample.account.form.CustomGroup.CustomButton1" Command="Sample.account.form.CustomGroup.CustomButton1.Command" Sequence="10" LabelText="Custom Button1" ToolTipTitle="Custom Button ToolTip" ToolTipDescription="Custom Button1 Tooltip Description " TemplateAlias="o1" Image16by16="/_imgs/ribbon/ActivityClose_16.png" Image32by32="/_imgs/ribbon/ActivtiyClose_32.png" />
                  <Button Id="Sample.account.form.CustomGroup.CustomButton2" Command="Sample.account.form.CustomGroup.CustomButton2.Command" Sequence="20" LabelText="Custom Button2" ToolTipTitle="Custom Button ToolTip" ToolTipDescription="Custom Button2 Tooltip Description " TemplateAlias="o1" Image16by16="/_imgs/ribbon/delete16.png" Image32by32="/_imgs/Workplace/remove_32.png" />
                </Controls>
              </Group>
            </CommandUIDefinition>
          </CustomAction>
          <CustomAction Id="Sample.account.form.CustomGroup.MaxSize.CustomAction" Location="Mscrm.Form.account.MainTab.Scaling._children" Sequence="71">
            <CommandUIDefinition>
              <MaxSize Id="Sample.account.form.CustomGroup.MaxSize" GroupId="Sample.account.form.CustomGroup.Group" Sequence="11" Size="LargeLarge" />
            </CommandUIDefinition>
          </CustomAction>
        </CustomActions>
        <Templates>
          <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
        </Templates>
        <CommandDefinitions>
          <CommandDefinition Id="Sample.account.form.CustomGroup.CustomButton2.Command">
            <EnableRules>
              <EnableRule Id="Mscrm.Enabled" />
            </EnableRules>
            <DisplayRules />
            <Actions>
              <JavaScriptFunction Library="$Webresource:new_accountmainlib" FunctionName="MyFunction" />
              
            </Actions>
          </CommandDefinition>
          <CommandDefinition Id="Sample.account.form.CustomGroup.Command">
            <EnableRules>
              <EnableRule Id="Mscrm.Enabled" />
            </EnableRules>
            <DisplayRules />
            <Actions />
          </CommandDefinition>
          <CommandDefinition Id="Sample.account.form.CustomGroup.CustomButton1.Command">
            <EnableRules>
              <EnableRule Id="Mscrm.Enabled" />
            </EnableRules>
            <DisplayRules />
            <Actions>
              <Url Address="http://google.com" />
            </Actions>
          </CommandDefinition>
        </CommandDefinitions>
        <RuleDefinitions>
          <TabDisplayRules />
          <DisplayRules />
          <EnableRules />
        </RuleDefinitions>
        <LocLabels />
      </RibbonDiffXml>

3. Now import the solution and check the changes.

Hope it helps!!!!!

1 comment: