Thursday 23 February 2012

CRM 2011 – Create Ribbon Popup buttons on entity ribbon

Dynamics CRM 2011 allows us to export a solution as managed or unmanaged solution. This solution is having the customization.xml file which contains all or selected portions of the customizations and configurations for your system. In this post I have described what to change in customization.xml file to have Ribbon popup button as shown in below screen shot.


1. Create a Solution or use an existing one.
2. Select components.


3. Add entity for which you want to edit the ribbon, in this example I have added “Flight Route” entity (a custom entity).
4. Export the solution with unmanaged option.
5. Unzip all files and open customizations.xml in visual studio.
6. Once you open it you could find RibbonDiffxml tag underneath an Entity node. In below screen shot I have highlighted the RibbonDiffXml of “Flight Route” entity.

Once you expand this element, you could see below xml

    <CustomActions />
    <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>   
   <CommandDefinitions />
  <TabDisplayRules />
  <DisplayRules />
  <EnableRules />
  <LocLabels />
In above screen shot I have highlighted 3 important elements of RibbonDiffXml xml. You need to replace those empty nodes with below xml.

Replace CustomActions with below xml content. In this example I have specified a publisher of solution with prefix as “acm”. My custom entity is acm_filightroute and a group name is “Airport”.

You need to replace these values with yours via find and replace feature of visual studio. Also change the label text and tool tip values  as per your need.
<CustomAction Id="acm.Form.acm_flightroute.MainTab.Airport.CustomAction" Location="Mscrm.Form.acm_flightroute.MainTab.Groups._children" Sequence="10">
<Group Id="acm.Form.acm_flightroute.MainTab.Airport" 
Description="$LocLabels:acm.Form. acm_flightroute.MainTab.Airport.DescriptionText">
<Controls Id="acm.Form.acm_flightroute.MainTab.Airport.Controls">
<SplitButton Id="acm.Form.acm_flightroute.MainTab.AirportPopUp" 
ToolTipTitle="Airport Popup Menu" 
ToolTipDescription="Popup Menu for Airport Entity" 
LabelText="Airport PopUp Menu" 
Alt="Airport PopUp Menu" 
<Menu Id="acm.Form.acm_flightroute.MainTab.AirportPopUp.Menu">
<MenuSection Id="acm.Form.acm_flightroute.MainTab.AirportPopUp.MenuSection" 
<Controls Id="acm.Form.acm_flightroute.MainTab.AirportPopUp.Controls">
<Button Id="acmacm.Form.acm_flightroute.MainTab.Airport.InsertNewAirport" 
TemplateAlias="o1" Image16by16="$webresource:acm_/Images/sample_iconsTIcon16x16png" Image32by32="$webresource:acm_/Images/sample_iconsTIcon32x32png" />
<Button Id="acmacm.Form.acm_flightroute.MainTab.Airport.ShowDialog" Command="acmacm.Form.acm_flightroute.MainTab.Airport.ShowDialog.Command" Sequence="20" ToolTipTitle="$LocLabels:acmacm.Form.acm_flightroute.MainTab.Airport.ShowDialog.LabelText" LabelText="$LocLabels:acmacm.Form.acm_flightroute.MainTab.Airport.ShowDialog.LabelText" ToolTipDescription="$LocLabels:acmacm.Form.acm_flightroute.MainTab.Airport.ShowDialog.Description" TemplateAlias="o1" Image16by16="$webresource:acm_/Images/sample_iconsTIcon16x16png" Image32by32="$webresource:acm_/Images/sample_iconsTIcon32x32png" />
<CustomAction Id="acm.Form.acm_flightroute.MainTab.Airport.MaxSize.CustomAction" Location="Mscrm.Form.acm_flightroute.MainTab.Scaling._children" Sequence="10">
<MaxSize Id="acm.Form.acm_flightroute.MainTab.Airport.MaxSize" GroupId="acm.Form.acm_flightroute.MainTab.Airport" Sequence="10" Size="LargeMedium" />
<CustomAction Id="acm.Form.acm_flightroute.MainTab.Airport.Scale.Popup.CustomAction" Location="Mscrm.Form.acm_flightroute.MainTab.Scaling._children" Sequence="10">
<Scale Id="acm.Form.acm_flightroute.MainTab.Airport.Scale.Popup" GroupId="acm.Form.acm_flightroute.MainTab.Airport" Sequence="300" Size="Popup" />

Below is a command definition tag. Replace the prefix and other values here as well.

<CommandDefinition Id="acmacm.Form.acm_flightroute.MainTab.Airport.InsertNewAirport.Command">
<EnableRules />
<DisplayRules />
<JavaScriptFunction FunctionName="CreateAirport" Library="$webresource:acm_/javascripts/LaunchNewEntry.js" />
<CommandDefinition Id="acmacm.Form.acm_flightroute.MainTab.Airport.ShowDialog.Command">
<EnableRules />
<DisplayRules />
<JavaScriptFunction FunctionName="LaunchModalDialog" Library="$webresource:acm_/javascripts/LaunchModalDialog.js">
<StringParameter Value="{e1e36d96-ced2-4ede-85e8-455e3cf4daaf}" />
<StringParameter Value="acm_flightroute" />
<CrmParameter Value="FirstPrimaryItemId" />

Apply the same procedure to below xml too.

<LocLabel Id="acmacm.Form.acm_flightroute.MainTab.Airport.InsertNewAirport.Description">
<Title languagecode="1033" description="Insert New Airport Description" />
<LocLabel Id="acmacm.Form.acm_flightroute.MainTab.Airport.InsertNewAirport.LabelText">
<Title languagecode="1033" description="Insert New Airport" />
<LocLabel Id="acmacm.Form.acm_flightroute.MainTab.Airport.ShowDialog.Description">
<Title languagecode="1033" description="Show Dialog Description" />
<LocLabel Id="acmacm.Form.acm_flightroute.MainTab.Airport.ShowDialog.LabelText">
<Title languagecode="1033" description="Show Dialog" />

7. Save Customization.xml.
8. Create a Zip file of all extracted files (in Step 5) including the updated customization.xml.


9. Import this newly created zip file back to CRM server.
10. Open entity form on which you have implemented popup button.
11. In my case I can see “Airport Popup Menu” in Airport group with Dropdown as shown below.


12. On click Dropdown button you can see two buttons.



  1. Hi,

    Really helpful post.

    Is it possible to have an image on the main button as well?


  2. Yes, it is.
    Please refer below blog post for the same.

  3. Hi,
    I referred your blog and added split button to custom entity form ribbon.But out of 10 buttons only two button is enabled for click and other is in disabled mode.

    Why like that ?

  4. Hi,
    I refered your blog and added custom split button to custom form ribbon.Here out of 10 buttons only first two button are enabled and renaming are in disabled mode.

    What is the reason for this ?

  5. Hi, I am trying this in Dynamics 2013, But i am getting an Error "The import file is invalid. XSD validation failed with the following error: '{0}'. The validation failed at: '...{1} <<<<>>>> {2}...'.""

  6. Hi, I suggest you to evaluate Ribbon Workbench tool to do so. For more details please refer following link:

  7. Hi Ankit,
    In my current project I would like to make dropdown for Ribbon buttons.

    for an example under Records below buttons should come

    New, Edit, delete .

    I am using Split button to achieve this but this split button is not showing all the buttons that I created under split button.

    1. Hi, Please add a menu item first at ribbon workbench and add a command for this item.

      Then associate that newly created command to the ribbon button.

      With these steps it should display the button under the split button.

      Can you please confirm that you perform the second step?

  8. Hi Ankit, I´m trying to add a splitButton into a spitButton but it doesn´t work. Is there a code to do something similar? Thanks!!

  9. Hi,

    According to my understanding it's not possible to add split button into another split button. Instead we can add Flyout menu into the split button and then add a simple button to that flyout.