Sample: Make a Report Context-Sensitive

[Applies to: Microsoft Dynamics CRM 2011]

The following steps describe how to set up a context-sensitive report in Microsoft Dynamics CRM.

For example, if a report displays all activities for a particular account and you want to show this report on the Microsoft Dynamics CRM Account form, you must include Activities and Accounts in the Related Record Types categorization and specify Forms for related record types in the Display in field of the Report: New form.

Create and configure a context-sensitive report

  1. Create a report that contains fields from a Filtered<entity> database view and establish one or more SQL JOINs with other related filtered views as required.

  2. Use CRMAF_Filtered<entity> as an alias name in the report's SQL query statement. For example:

    SELECT CRMAF_FilteredActivityPointer.activitytypecodename as
    CRMAF_FilteredActivityPointer.regardingobjectidname as regardingobjectidname,
    CRMAF_FilteredActivityPointer.subject as subject,
    FROM FilteredActivityPointer AS CRMAF_FilteredActivityPointer
    INNER JOIN FilteredAccount As CRMAF_FilteredAccount on
    CRMAF_FilteredAccount.accountid = 

    If you have a fetch-based report, you can use the following FetchXML query instead of the SQL query:

      <entity name="activitypointer" enableprefiltering="1" >
        <attribute name="activitytypecode" />
        <attribute name="regardingobjectid" />
        <attribute name="subject" alias="subject" />
        <link-entity name="account" from="accountid" to="regardingobjectid" link-type='inner' alias="accountLink">
          <attribute name="name" alias="name" />
  3. When you upload the report to Microsoft Dynamics CRM through the Report: New form, select all entities in the Related Record Types categorization that filtered views are referred to in the report's SQL code.

  4. In Display In field, select Forms for related record types or Lists for related record types. Selecting Lists for related record types enables you to run a report from the entity list grid. Selecting Forms for related record types lets you run a report from the entity form.

See Also

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