Thursday, August 4, 2011

Changing OOB Ribbon Button Label in CRM 2011

Hi All, Here I am going to change the OOB Ribbon Button label. Now I am going to Change OOB "DeActive" Button Lable to "InActive" on the Account Form.

Account Form Ribbon Before Changing Label for "Deactive" Button

Account Form Ribbon After Changing  "Deactive" Button Label to "InActive"

1. Open “accounribbon.xml” file from the “\sdk\samplecode\cs\client\ribbon\exportribbonxml\exportedribbonxml” location in the CRM 2011 SDK.

2. Find the "Deactive" Ribbon Button definition
 <Group Id="Mscrm.Form.account.MainTab.Save" Command="Mscrm.Enabled" Sequence="10" Title="$Resources:Ribbon.Form.MainTab.Save" Image32by32Popup="/_imgs/ribbon/Save_32.png" Template="Mscrm.Templates.Flexible2">
                <Controls Id="Mscrm.Form.account.MainTab.Save.Controls">
                  <Button Id="Mscrm.Form.account.SaveAsComplete" ToolTipTitle="$Resources:Ribbon.Form.MainTab.Save.SaveAsComplete" ToolTipDescription="$Resources(EntityDisplayName):Ribbon.Tooltip.SaveAsComplete" Command="Mscrm.SavePrimaryActivityAsComplete" Sequence="10" LabelText="$Resources:Ribbon.Form.MainTab.Save.SaveAsComplete" Alt="$Resources:Ribbon.Form.MainTab.Save.SaveAsComplete" Image16by16="/_imgs/ribbon/SaveAsCompleted_16.png" Image32by32="/_imgs/ribbon/SaveAsCompleted_32.png" TemplateAlias="o1" />
                  <Button Id="Mscrm.Form.account.Save" ToolTipTitle="$Resources:Mscrm_Form_Other_MainTab_Save_Save_ToolTipTitle" ToolTipDescription="$Resources(EntityDisplayName):Ribbon.Tooltip.Save" Command="Mscrm.SavePrimary" Sequence="20" LabelText="$Resources:Ribbon.Form.MainTab.Save.Save" Alt="$Resources:Ribbon.Form.MainTab.Save.Save" Image16by16="/_imgs/ribbon/Save_16.png" Image32by32="/_imgs/ribbon/Save_32.png" TemplateAlias="o1" />
                  <Button Id="Mscrm.Form.account.SaveAndClose" ToolTipTitle="$Resources:Mscrm_Form_Other_MainTab_Save_SaveAndClose_ToolTipTitle" ToolTipDescription="$Resources(EntityDisplayName):Ribbon.Tooltip.SaveAndClose" Command="Mscrm.SaveAndClosePrimary" Sequence="30" LabelText="$Resources:Ribbon.Form.MainTab.Save.SaveAndClose" Alt="$Resources:Ribbon.Form.MainTab.Save.SaveAndClose" Image16by16="/_imgs/FormEditorRibbon/SaveAndClose_16.png" Image32by32="/_imgs/ribbon/SaveAndClose_32.png" TemplateAlias="o1" />
                  <Button Id="Mscrm.Form.account.SaveAndNew" ToolTipTitle="$Resources:Mscrm_Form_Other_MainTab_Save_SaveAndNew_ToolTipTitle" ToolTipDescription="$Resources(EntityDisplayName):Ribbon.Tooltip.SaveAndNew" Command="Mscrm.SaveAndNewPrimary" Sequence="40" LabelText="$Resources:Ribbon.Form.MainTab.Save.SaveAndNew" Alt="$Resources:Ribbon.Form.MainTab.Save.SaveAndNew" Image16by16="/_imgs/ribbon/saveandnew16.png" Image32by32="/_imgs/ribbon/saveandnew32.png" TemplateAlias="o2" />
                  <Button Id="Mscrm.Form.account.Activate" ToolTipTitle="$Resources:Ribbon.HomepageGrid.account.Record.Status.Activate" ToolTipDescription="$Resources(EntityPluralDisplayName):Ribbon.Tooltip.Activate" Command="Mscrm.Form.Activate" Sequence="50" Alt="$Resources:Ribbon.HomepageGrid.account.Record.Status.Activate" LabelText="$Resources:Ribbon.HomepageGrid.account.Record.Status.Activate" Image16by16="/_imgs/ribbon/Activate_16.png" Image32by32="/_imgs/ribbon/Activate_32.png" TemplateAlias="o2" />
                  <Button Id="Mscrm.Form.account.Deactivate" ToolTipTitle="$Resources:Ribbon.HomepageGrid.account.Record.Status.Deactivate" ToolTipDescription="$Resources(EntityPluralDisplayName):Ribbon.Tooltip.Deactivate" Command="Mscrm.Form.Deactivate" Sequence="60" Alt="$Resources:Ribbon.HomepageGrid.account.Record.Status.Deactivate" LabelText="$Resources:Ribbon.HomepageGrid.account.Record.Status.Deactivate" Image16by16="/_imgs/ribbon/deactivate16.png" Image32by32="/_imgs/ribbon/Deactivate_32.png" TemplateAlias="o2" />
                  <Button Id="Mscrm.Form.account.Delete" ToolTipTitle="$Resources:Mscrm_Form_Other_MainTab_Management_Delete_ToolTipTitle" ToolTipDescription="$Resources(EntityPluralDisplayName):Ribbon.Tooltip.Delete" Command="Mscrm.DeletePrimaryRecord" Sequence="70" LabelText="$Resources:Ribbon.HomepageGrid.MainTab.Management.Delete" Alt="$Resources:Ribbon.HomepageGrid.MainTab.Management.Delete" Image16by16="/_imgs/ribbon/delete16.png" Image32by32="/_imgs/Workplace/remove_32.png" TemplateAlias="o2" />
                </Controls>
              </Group>

3. Now Export the current solution and then extract the zip file, open "Customizations.xml" file in edit mode.

4.  Find the  <RibbonDiffXml> at Account Entity level and then edit the <customActions> section to rename the 'DeActive" label.

 <CustomActions>
          <CustomAction Id="Sample.Form.account.Deactivate.CustomAction" Location="Mscrm.Form.account.Deactivate" Sequence="61">
            <CommandUIDefinition>
              <Button Id="Mscrm.Form.account.Deactivate" ToolTipTitle="$Resources:Ribbon.HomepageGrid.account.Record.Status.Deactivate" ToolTipDescription="$Resources(EntityPluralDisplayName):Ribbon.Tooltip.Deactivate" Command="Mscrm.Form.Deactivate"  Alt="$Resources:Ribbon.HomepageGrid.account.Record.Status.Deactivate" LabelText="InActive" Image16by16="/_imgs/ribbon/deactivate16.png" Image32by32="/_imgs/ribbon/Deactivate_32.png" TemplateAlias="o2" />
            </CommandUIDefinition>
          </CustomAction>
        </CustomActions>

Here we are changing the OOB "DeActive" Label text to "InActive" in the customActions section. But the Ribbon Button functionality will be same. If you wants to override the functionality of the button, you can change the  <CommandDefinitions> of the button.

5. Now Import the solution back to CRM. verify the changes..

Hope it helps!!!!



1 comment: