Copy Reports Between Microsoft Dynamics CRM Deployments

[Applies to: Microsoft Dynamics CRM 2011]

The preferred method to copy a report between organizations or deployments is to include the report and any custom entities the report uses in a solution. If you do this, the entity types are mapped automatically by the system. If you choose to manually copy a report to another Microsoft Dynamics CRM deployment, you must change the entity type codes for custom entities referred to in the report.

In This Topic

Fix the Type Code for a Custom Entity Used in a Report

Copy a Report between Deployments

Fix the Type Code for a Custom Entity Used in a Report

The type code for a custom entity may be different on different Microsoft Dynamics CRM installations. If your report contains references to a custom entity type code, such as when you perform a drill-through to a custom Microsoft Dynamics CRM entity, you must change the type code of the custom entity referred to in your report to the actual type code of the custom entity on the other system you are deploying the report to.

The entity type code for all default (non-custom) entities are pre-defined. For more information, see IOrganizationService Entities. You can retrieve the type codes for all entities, including custom entities, by using the RetrieveAllEntitiesRequest message. For sample code, see Sample: Dump Entity Metadata to a File.

An alternative method to determine the entity type code is to open the edit form for the entity, and then press F11. The URL is displayed in the address bar in Internet Explorer. The last part of the URL shows the type code:

&etc=<entity_type_code>. 

The recommended method to refer to the type code is to define a hidden parameter in the report and set its value to the custom entity type code on the original system. After deployment to another Microsoft Dynamics CRM installation, use Report Manager to set the parameter's value to the type code of the custom entity on that system.

  1. Obtain the custom entity's type code value. To do this, run Microsoft SQL Query Analyzer and execute the following SQL command on the Microsoft Dynamics CRM database. Substitute an appropriate organization name. Locate the type code of your custom entity in the resultset.

    use <organization>_MSCRM
    select Name,ObjectTypeCode from dbo.Entity order by ObjectTypeCode
    
  2. In the report, create two report parameters: CRM_URL and CRM_OTC. CRM_OTC should be of type string. The default CRM_OTC value should be set to the value obtained in step 1.

  3. On the report item that should be used for a drill-through link, add the following Value code:

    =Parameters!CRM_URL.Value &"?ID={" & Fields!new_custentityid.Value.ToString() & "}&OTC="+Parameters!CRM_OTC.Value
    
  4. Preview and save the report.

  5. Copy the report to the destination server according to the instructions in the following section.

Copy a Report between Deployments

After you redeploy Microsoft Dynamics CRM from one server to another, custom reports must be individually copied to the redeployed (destination) server.

To redeploy one or more reports

  1. When you copy a report that references a custom entity type code, you should update the definition of the CRM_OTC report parameter to reflect the object type code of the entity in the destination system.

    From the destination Microsoft Dynamics CRM server, open a browser window and navigate to the source system Microsoft Dynamics CRM.

  2. In the Microsoft Dynamics CRM Reports grid, select the custom report. On the toolbar, select Edit Report and then select Actions. In the Actions menu, select Download Report.

  3. Click Save. Specify a file name when you are prompted and save the report to the destination system. A copy of the report now exists on the destination system.

  4. In the browser, navigate to Microsoft Dynamics CRM on the destination system.

  5. In the toolbar located above the Microsoft Dynamics CRM Reports grid, click New.

  6. In the Report:New dialog box, fill in the source file location. Also, fill in the Details section of the form.

  7. Click Save and Close.

  8. Your report will now be displayed in the Reports grid. You may have to select an appropriate category or entity from the drop-down menus above the toolbar to see the report.

    If you do not want to define a default filter, go to step 14.

  9. Select your report in the Reports grid.

  10. In the toolbar, point to More Actions, and then click Edit Default Filter from the menu.

  11. In the Report Viewer dialog box, define the default filter criteria that will be used every time the report runs.

  12. Click Save Default Filter.

  13. Run the report.

After the report is tested and functions correctly, follow these steps to add the report to context-sensitive lists and forms within Microsoft Dynamics CRM.

To add the report to context-sensitive lists and forms in Microsoft Dynamics CRM

  1. Select the report in the Reports grid.

  2. On the Actions toolbar, click Edit Report.

  3. In the Report dialog box, fill in the Categorization section according to the following descriptions.

    • Categories: Categorizes the report according to its intended purpose. For example, a sales report can be included in context-sensitive lists and forms in the Sales area of Microsoft Dynamics CRM.

    • Related Record Types: Associates the report to specific entities, such as an account or contact. The report can be displayed in context-sensitive lists and forms for those entities.

    • Display In: This setting enables the report to be displayed in context-sensitive forms and lists. You can restrict where the report is displayed by using this setting. If you intend to publish a hidden report, clear the Display In text box.

  4. Click Save and Close.

See Also

Concepts

Publish Reports

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.