2
votes

I am using FetchXML in SSRS 2008 to create a report from CRM 2011. I want to have parameters in the report so you can show the records between From Date - To Date. This is the Query I have so far.

<fetch>
      <entity name="appointment">
        <attribute name="scheduledstart" />
        <link-entity name="systemuser" from="systemuserid" to="ownerid">
            <attribute name="firstname" alias="ownerFirstName" />
            <attribute name="lastname" alias="ownerLastName" />
        </link-entity>
        <link-entity name="contact" from="contactid" to="new_contactperson">
            <attribute name="parentcustomerid" alias="parentaccount" />
            <attribute name="new_businessunit" alias="businessunit" />
        </link-entity>
        <attribute name="new_contactperson" />
        <attribute name="subject" />
        <attribute name="new_coldernotes" />
    <link-entity name="activityparty" from="activityid" to="activityid">
    <attribute name="participationtypemask" alias="participationtypemask" />
        <filter>
        <condition attribute="participationtypemask" operator="eq" value="9" />
        </filter>
        <link-entity name="systemuser" from="systemuserid" to="partyid">
            <attribute name="fullname" />
        </link-entity>
    </link-entity>
    <order attribute="scheduledstart" descending="true" />
      </entity>
</fetch>

How would I make it so I can filter between the dates?

Thanks!

1

1 Answers

5
votes

Not sure if you have access to the native CRM client, but the Advanced Find view quickly generates this sample FetchXML:

<filter type="and">
  <condition attribute="modifiedon" operator="on-or-after" value="2011-10-04" />
  <condition attribute="modifiedon" operator="on-or-before" value="2011-11-13" />
</filter>