Thursday, 26 May 2016

05:03 - No comments

Adding New Button to Ribbon at form level and grid level for custom entity in CRM || MS CRM

Adding New Button to Ribbon at form level and grid level for custom entity in CRM



1. Export the solution to which we wants to create custom button
2. Extract the solution and open the "custmizations.xml" file to edit.
3. Find "RibbonDiffXml" tag for the particular custom entity which you want to add button.
 Now replace the "RibbonDiffXml" tag with the following code, it will adds a button to the chosen entity at grid level and form level.



<RibbonDiffXml>
        <CustomActions>

<!-- This to add button in formlevel after exportdata button , CI_formlevel is any unique Id, sequence Number is the position of the button,75 will shows button before Export Excel,you can find sequence numbers of system buttons in SDK-->

          <CustomAction Id="CI_formlevel" Location="Mscrm.Form.new_entityname.MainTab.ExportData.Controls._children" Sequence="75">
            <CommandUIDefinition>
              <Button Id="B_formbutton" Command="Cmd_JavaScript1" LabelText="Custom Button" ToolTipTitle="My Form Button" ToolTipDescription="Form Level Button" TemplateAlias="o1" Image16by16="$webresource:Icon_imgSmall" Image32by32="$webresource:Icon_imgMedium" />
            </CommandUIDefinition>
          </CustomAction>


<!-- this to add button at gridlevel -->

          <CustomAction Id="CI_Gridlevel" Location="Mscrm.HomepageGrid.new_entityname.MainTab.ExportData.Controls._children" Sequence="75">
            <CommandUIDefinition>
              <Button Id="B_GIncident" Command="Cmd_JavaScript1" LabelText="Grid Button" ToolTipTitle="Grid Button" ToolTipDescription="Grid Level button" TemplateAlias="o1" Image16by16="$webresource:Icon_imgSmall" Image32by32="$webresource:Icon_imgMedium" />
            </CommandUIDefinition>
          </CustomAction>
        </CustomActions>
        <Templates>
          <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
        </Templates>
        <CommandDefinitions>
          <CommandDefinition Id="Cmd_JavaScript1">
            <EnableRules>
              <EnableRule Id="Mscrm.Enabled" />
            </EnableRules>
            <DisplayRules />
            <Actions>

<!-- call java script library function -->

              <JavaScriptFunction Library="$webresource:new_jscrlib" FunctionName="myfunction"></JavaScriptFunction>
            </Actions>
          </CommandDefinition>
        </CommandDefinitions>
        <RuleDefinitions>
          <TabDisplayRules />
          <DisplayRules />
          <EnableRules />
        </RuleDefinitions>
        <LocLabels />
      </RibbonDiffXml>

0 comments:

Post a Comment