Generating Image dynamically in SSRS Report from CRM - CloudFronts

Generating Image dynamically in SSRS Report from CRM


It is possible to Fetch images from CRM’s entity records using Fetch XML.  This can be done using Notes attachment in CRM and the steps to display the Image in your report are pretty simple as well.


  1. Attach your image to a note under your respective entity in CRM

    Fig 1: Notes attachment
  2. In your Visual Studio copy paste the following code in your Query Designer
    <fetch mapping="logical" output-format="xml-platform" version="1.0">
    <entity name="annotation">
    <attribute name="subject"/>
    <attribute name="notetext"/>
    <attribute name="filename"/>
    <attribute name="filesize"/>
    <attribute name="documentbody"/>
    <attribute name="annotationid"/>
    <attribute name="mimetype"/>
    <attribute name="objectid"/>
    <filter type="and">
    <condition attribute="mimetype" value="%image%" operator="like"/>
    <order descending="false" attribute="subject"/>
  3. Add an Image Control in your Report. If you want to generate multiple images then you can add the Image Control under a Table

    Fig 2: SSRS Table
  4. Go to Image properties and select the image source as Database. Under field select documentbody and select your MIME type to whichever image format you want it to be

    Fig 3: Image properties
  5.  Click on preview and your image should be rendered in your report

    Fig 4: Final image preview


Thus you can store images in your CRM and generate dynamic SSRS reports with these images easily.

Share Story :

Secured By miniOrange