Pages

Monday, May 14, 2012

Embedding Reports in a CRM Form

In CRM 4.0 we were able to embed CRM reports into directly into an entity form via the use of an IFrame. This old post walks through the configuration of that option. This is useful in several instances, such as:

  • Creating charts, tables, etc. to be able to easily visualize the data (e.g. a chart showing the total purchases by product line for the account being viewed right in the body of the form)
  • Pulling information from other applications into a form - a kind of "virtual" integration

Fortunately this can also be accomplished in CRM 2011 using html web resources.

We will start by referencing a Microsoft team post that walks through the process of embedding reports on a CRM 2011 dashboard (very useful in and of itself). This post references an html web resource that can be downloaded and used to configure the dashboard option.

The only difference between embedding a report into the dashboard versus is embedding into a form is "context sensitivity". That is, by it's very definition a dashboard is a high level view of data to enable the data to be visualized, analyzed and drilled down into. While the same kind of analysis could apply at the form level (e.g. viewing a summary of orders, invoices etc. for a particular customer), the report at the form level should (in most cases) be showing data that is linked/relevant to the entity that you are viewing.

So with that in mind, all we need to do with the html web resource referenced above is context sensitivity and then we can leverage that for to embed CRM reports into a form. And this is precisely what we have done - you can download the solution containing the html web resource for displaying embedded reports from here.

Once you have done so, all you need to do display the embedded report is to insert the web resource into the form as shown and to pass in the report ID in the Custom Parameters (see Microsoft's post on how to obtain the report ID).



 After publishing, open your form and you should see something that looks like this:



It would be nice too if we could hide the report header information (i.e. everything shown in blue in the screenshot above) however that appears to be somewhat challenging. If you're using a reporting services URL then you can tack on parameters such as the one below to suppress this (see the following post for a complete list of reporting services URL parameters):

&rs:Command=Render&rs:ClearSession=true&rc:ToolBar=false


However if you're trying to render the report using the "/crmreports/viewer/viewer.aspx" approach (which is how all reports natively get called from CRM and therefore is preferred and is also used that way in the web resource), then the parameters above will not work. If anyone has figured this one out I'd appreciate if you could enlighten me.

4 comments:

  1. Thanks, works great!
    One minor clarification, though: in order for the context-sensitivity to work, you need to check the checkbox for "Pass record object type code and unique identifier as parameters". (Your screenshot did not have that checked.)

    I also have struggled to solve the problem of displaying embedded reports without showing all the parameters in the viewer. This limitation makes it really hard to make useful dashboards to which you can pass parameters.

    ReplyDelete
  2. Thanks. And thanks for the correction.

    ReplyDelete
  3. Did you find the solution?? because i am facing same thing.

    Thanks in advance

    ReplyDelete