Thursday 15 September 2011

How to display Images that are attached to Notes for CRM 2011 Online – Using FetchXML

How to display Images that are attached to Notes for CRM 2011 Online – Using FetchXML

Create a Query using the Advanced Find in CRM 2011, download the FetchXML from it and edit the file. The actual image is stored in a field which isn’t visible in the CRM GUI, it’s called documentbody. Here’s an example with it in, if you add this code below to your SSRS Dataset then it will show you all notes created this month with the image. Then simple add an <Image> from within BIDS and set the image properties field to the documentbody and MIME type to jpg, gif, png etc..

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="annotation">
    <attribute name="subject" />
    <attribute name="notetext" />
    <attribute name="filename" />
    <attribute name="annotationid" />
    <attribute name="overriddencreatedon" />
    <attribute name="documentbody" />
    <attribute name="ownerid" />
    <attribute name="annotationid" />
    <attribute name="filesize" />
    <order attribute="subject" descending="false" />
    <filter type="and">
      <condition attribute="createdon" operator="this-month" />
    </filter>
  </entity>
</fetch>

Works a treat J

4 comments:

  1. Hmm. We are trying to use the documentbody atribute to display an image in a report, but the fetch is only returning the first 2000 characters of data for the image. Any ideas what the problem might be?

    ReplyDelete
  2. thanks for the info! do you also know how to return to image of Service>Employee Entity?

    ReplyDelete
  3. Excellent post! Works perfectly. Thank you

    ReplyDelete
  4. Is it possible to retrieve multiple note attachments ? I need to retrieve the initial 4 attachments in the FetchXML report

    ReplyDelete

ADFS Timeout on Server 2012 for CRM 2011

This follows on from this Microsoft Guide http://social.technet.microsoft.com/wiki/contents/articles/7681.setting-the-adfs-timeout-for-crm...