Generating Image dynamically in SSRS Report from CRM
Introduction:
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.
Steps:
- Attach your image to a note under your respective entity in CRM
- 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"/> </filter> <order descending="false" attribute="subject"/> </entity> </fetch>
- Add an Image Control in your Report. If you want to generate multiple images then you can add the Image Control under a Table
- 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
- Click on preview and your image should be rendered in your report
Conclusion:
Thus you can store images in your CRM and generate dynamic SSRS reports with these images easily.