FetchXML Query Examples
For those who don't know what Fetch in CRM 3.0 is I will briefly explain it.
Fetch is a method that CRM 3.0 uses to read data through it's API.
It is very easy to write a Fetch query.
Instead of writing a long tutorial I will try to explain how to use Fetch by examples.
The basic Fetch format:
<fetch mapping='logical'>
<entity name='[Schema entity name]'>
<all-attributes/>
<filter type='and' or type='or'>
<condition attribute='[Attribute name Case sensitive]' operator='eq' <--equals value='111038-18938-0...'/>
</filter>
</entity>
</fetch>
Example 1: Fetch contacts for a particular owner
<fetch mapping='logical'>
<entity name='contact'>
<all-attributes/>
<filter type='and' >
<condition attribute='ownerid' operator='eq' value='111038-18938-0...'/>
</filter>
</entity>
</fetch>
This query will retrieve the contact list for a particular owner.
Example 2: Activities for an owner that are due date
<fetch mapping='logical'>
<entity name='activitypointer'>
<all-attributes/>
<filter type='and' >
<condition attribute='ownerid' operator='eq' value='111038-18938-0...'/>
<condition attribute='scheduleend' operator='today'/>
</filter>
</entity>
</fetch>
This query gets the activities for a particular owner that are due today, the keyword today is understood by CRM 3.0 as the day of execution.
This will help you get your feet wet using Fetch.
It is easy to learn, especially with the use of an application called FetchXML Builder.
***If anyone knows the link to the website that hosts the FetchXML Builder, please send it to me.***
P.S: I accept private questions feel free to leave me a comment on the blog, I usually answer them quickly.
Have a great day.
Oshri Cohen
