Monthly Archives: September 2012

How to create a custom Ribbon button in MS Dynamic CRM 2011

  • Go to Settings -> Customization -> Solutions.
  • Click ‘New’ button on Solutions page.
  • Fill up Display Name, Name, Publisher and Version as shown in the below figure and click ‘Save’.
  • Select ‘Entities’ and click ‘Add Existing’. A popup window will come out and choose any one of the entities to which you want to add the ribbon button. I will choose ‘Case’ entity here.

When you see the following dialog, choose ‘No, do not include required components’ as we are just going to add a custom ribbon button.

  • We will add the icons (16×16 and 32×32) to be used for the ribbon icon. Choose ‘Web Resources’ and click ‘New’ button as shown in the figure.
  • Fill up Name, Display Name, Type and upload the icon file as shown in the figure and click ‘Save and Close’.
  • Repeat the step no.6, and upload 32×32 icon file with the file name of ‘btn_dialog32’.
  • Add another web resource and fill up Name, Display Name, Type and click ‘Text Editor’ as shown in the figure.
  • Write java script as shown in the figure.

(You can write java script in TextEditor or you can upload java script file.)

After adding the javascript, you will see the URL as shown in the below figure. Then click ‘Save and Close’.

  • Now you will see there are two icons and one java script in your web resources. Click ‘Save and Close’.
  • Select the solution you have created just now and click ‘Export’. When the system prompts the dialog, click ‘Publish All Customizations’ button and after that, click ‘Next’ button.

Ignore all the warnings and click ‘Next’.

Export as ‘Unmanaged’.

(You need to export the solution you created so that you can add your customized ribbon button.)

  • The exported file is saved as in the form of zip file. Find the zip file and extract it. There is a file called ‘customizations.xml’. Open the file and look for <RibbonDiffXml> tag in order to edit it.
  • Replace existing <RibbonDiffXml> section with the following:



<CustomAction Id=”CI_formlevelHelloRibbonButton” Location=”Mscrm.Form.incident.MainTab.Actions.Controls._children” Sequence=”99″>


<Button Id=”B_formbuttonHelloRibbonButton” Command=”Cmd_DialogHelloRibbonButton”

LabelText=”Hello Ribbon” ToolTipTitle=”Hello Ribbon Button” ToolTipDescription=”This is my first ribbon button.” TemplateAlias=”o1″

Image16by16=”$webresource:new_btn_dialog16″ Image32by32=”$webresource:new_btn_dialog32″/>





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


<CommandDefinitions >

<CommandDefinition Id=”Cmd_DialogHelloRibbonButton”>


<EnableRule Id=”Mscrm.Enabled” />


<DisplayRules />


<JavaScriptFunction FunctionName=”HelloCustomRibbon” Library=”$webresource:new_showWelcomeMessge” >






<TabDisplayRules />

<DisplayRules />

<EnableRules />


<LocLabels />


  • Unzip the files and import into the system as shown in the figure.

Ignore the warning and click ‘Next’.

After importing, publish all the customizations again.

  • After that, Go to Service -> Cases and open one of the cases. You will see a new ribbon button on the case form. When you click that ribbon button, you will see the message as shown in the figure.

Leave a comment

Filed under Custom Ribbon, MS Dynamic CRM 2011