Tuesday, February 17, 2009

Force update of Report

The project I am currently involved in uses Reporting Services reports that are shown as PDF:s as quotes that are sent to the customer. It is implemented by creating a custom report that takes the object id (like quote) which is called from an isv.config button and by using querystring parameters, the output is directed to PDF.

However, I got a puzzeling bug. The data in the quote is of course based on data in some CRM entities and when a quote was generated and the user found something was wrong, changed this in CRM, saved and then tried to regenerate the PDF, the change didn't show. I restared Internet Explorer, and regenerated the quote-pdf and now it showed correctly. Hence some sort of caching error.

I looked around the internet a bit and found that by adding the following parameter to the querystring, I could refresh the sessions variables and I would get a fresh and correct report.´

&rs:ClearSession=true

So, the entire url was (except for the report id etc.):

&rs:Command=Render&rs:ClearSession=true&objid={D1F1FD5D-D7F8-DD11-967B-005056AA29F5}&rs:Format=PDF

So, if you get a similar error, just try setting this.

It is also possible that IE caches the pdf and then you'll have to add some variable to the querystring, like a tick or datetime that is unique for every call (from that client) and that will bypass IE:s caching.

Gustaf Westerlund
Microsoft Dynamics CRM Architect

Logica
www.logica.com

2 comments:

  1. hi Gustaf,
    I'm new to CRM. I get same bug with u where i can't get update report until i do right click + refresh on report page.

    can i know where i add "rs:clearsession=true"?
    how to do that?

    thanks.

    ReplyDelete
  2. Hi!
    Is this a report that you run inside CRM?

    The blog posting treats the issue when you are working with reports using direct URL:s and not through the CRM "proxy".

    Gustaf

    ReplyDelete