Friday, December 6, 2013

“Run Report” button on custom entities forms

In CRM2013 the “Run Report” button is missing on custom entities. The button is not available even if you have selected display in the “Forms of the related record types”. The problem is the “Display Rule” named “Mscrm.HideOnCommandBar” associated with the “Run Report” button. It is a default behaviour for custom entities.

There are 2 different ways to display the “Run Report” button on the custom entities.

By adding the "CommandDefinition” to the ribbon definition of the entity.

  1. Create a new solution in CRM, add contact entity to the solution and export the solution.
  2. Open the customization file from the exported solution and look for <RibbonDiffXML> . It will look like the following XML.
  3. <RibbonDiffXml>
      <CustomActions />
        <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
      <CommandDefinitions />
        <TabDisplayRules />
        <DisplayRules />
        <EnableRules />
      <LocLabels />
  4. Replace the highlighted line yellow with the following XML
  5. <CommandDefinition Id="Mscrm.ReportMenu.Form">
          <EnableRule Id="Mscrm.FormStateNotNew" />
          <DisplayRule Id="Mscrm.ReadReport" />
        <Actions />
  6. Save the file and overwrite the Customization file in your exported solution zip file with this file.
  7. Import the solution zip file and publish it. It’s done.

By using  Ribbon Work Bench 2013

Report button can be easily restored using “Ribbon Work Bench 2013”. Check for the step by step instructions.
Note: Make sure in the step 4 of the instructions,  “Form” is selected in the upper right corner as shown in the following screen shot.