Customization · Dynamics CRM 2011 · Ribbon

CRM 2011: Add Custom Ribbon Button on (Application Ribbon) Advanced Find

Following my previous post on CRM 2011: Adding Custom Button on Entity Form Ribbon, this post discuss how to add a custom ribbon on CRM Application Ribbon, more specifically Advanced Find form Ribbon.

These are the steps:
1. (Optional) To make things easier, I created a new unmanaged solution called ‘Ribbon’.
2. (Optional) Using exportribbonxml tool, export the ribbon definitions and locate applicationribbon.xml to help with ‘Location’ in your custom ribbon button definition.
3. Add ‘Application Ribbons’ to the solution using ‘Add Existing’ button.
4. Export the solution and open ‘customization.xml’ file.
5. Add custom ribbon button definition to ‘RibbonDiffXml’, in this example I use result icons, but you can use $webresource to point to your custom web resource.

<CustomActions>
  <CustomAction Id="AdvancedFind.CustomButton.CustomAction" Location="Mscrm.AdvancedFind.Groups.Show.Controls._children" Sequence="75">
    <CommandUIDefinition>
      <Button Id="AdvancedFind.CustomButton.Button" Command="AdvancedFind.CustomButton.Command" LabelText="Custom" ToolTipTitle="Custom" ToolTipDescription="Description" Image16by16="/_imgs/ribbon/Results_16.png" Image32by32="/_imgs/ribbon/Results_32.png" TemplateAlias="o1" Sequence="40" />
    </CommandUIDefinition>
  </CustomAction>
</CustomActions>

6. Also add the enable and display rules if required and action, in this case the action is just a simple url

<CommandDefinitions>
  <CommandDefinition Id="AdvancedFind.CustomButton.Command">
    <EnableRules />
    <DisplayRules />
    <Actions>
      <Url Address="http://www.google.com"></Url>
    </Actions>
  </CommandDefinition>
</CommandDefinitions>

7. Zip it up and import and publish the customization.

To access information about the advanced find window, you can use variable advFind.
To get the fetch xml query from advanced find window variable.

var fetchXml = advFind.FetchXml;

Two very interesting further reads,
Add mapping to Advanced Find
Adding a Button to the Main CRM Ribbon in 2011

Cheers – Sy

Advertisements

One thought on “CRM 2011: Add Custom Ribbon Button on (Application Ribbon) Advanced Find

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s