Images most often are embedded within the report like a company logo. But if you wanted to display an image in the report that was attached as a note in CRM you can still do it in very easy steps.
1. Design the query to read the note attachments.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" count="1">
<entity name="annotation">
<attribute name="documentbody" />
</entity>
</fetch>
2. The attachment content is stored in the documentbody attribute of the annotation entity. This data is stored in byte format and we would need to do the necessary conversion to display in image format.
To set it as image source add image control and set the image source as Database and MIME type as image/jpeg and for use this field you will have to use the document body field.
To use document body field you will have to use the below expression
=System.Convert.FromBase64String(First(Fields!documentbody.Value, "DsImage"))
Now just click ok and the image control will show the image that is found in the attachment when the report is executed
This will help include dynamic images in the report by storing them in notes attachment within CRM.
Posted by: Inogic
For more information/discussions (documents, sample code snippets, detailed work flow or diagrams),
Please be free to visit the following links or email us:
Web: http://www.inogic.com
Blog: http://inogic.blogspot.com
Email: news@inogic.com
--------------------------------------------------