Search

Wednesday, February 3, 2010

Display Report in IFrame

Recently I read a blog on displaying SSRS report in IFrame of CRM entities. Now, I'm going to share with the workaround..

For this example, we created a custom report that takes in the Account Id as a parameter and displays the report.

  1. To add report in report manager, go to report manager URL and upload the report file .*rdl.
  2. After that, to find the report URL, go to report server and right click on report's properties to copy the URL.
  3. Add a IFrame in Account entity and URL of the IFrame, enter ‘about:blank’.
  4. We will now add logic in the form OnLoad event that will create the report URL and append the Account Id for the report to use to display the report.
  5. Add the following codes in OnLoad.
    var guid = crmForm.ObjectId;
    
    var url = 'http://tbe/ReportServer?%2fTesting_AddReportIntoIFrame&rs:Command=Render&rs:Format=HTML4.0&rc:Toolbar=false&rc:Parameters=false&rc:Parameters=false&AccountId=' + guid;
    
    document.getElementById('IFRAME_Testing').src = url;
    
    
  6. Now save and close the form and publish the entity.
  7. Navigate to an account and you should see the new tab and report render in the IFrame.
Notes:
  • Since we want the report in an IFrame, we do not want the report viewer toolbar and parameters to show. Hence the ‘rc:Toolbar=false&rc:Parameters=false”. Since we want the report to render in HTML 4.0, we can specify the format to render the report in by specifying ‘rs:Format=HTML4.0’. 

2 comments: