FetchXML is
proprietary query language used in Microsodt Dynamics CRM online or on-premises
to retrieve records from an entity. It is depends on schema language. In terms
of capabilities it is equal to queryexpression,
and it has addition feature of save query as user-owned saved view in
userQuery system entity and and as an organization-owned saved view in the
savedquery entity.
We will run FetchXML
and retrieve records using RetrieveMultiple method by creating FetchExpression
object.
Below is the sample
code on running fetchXML.
String
fetchXML=@"<fetch mapping='logical'>
<entity name='account'>
<attribute name='accountid'/>
<attribute name='name'/>
</entity>
</fetch>";
FetchExpression
fetchExpression=new FetchExpression(fetchXML);
EntityCollection
entityCollection=service.RetrieveMultiple(fetchExpression);
Note: Don’t retrieve
all attributes in a query because of the negative effect on performance. This
is particularly true if the query is used as a parameter to an update request.
In an update, if all attributes are included this sets all field values, even
if they are unchanged, and often triggers cascaded updates to child records.
No comments:
Post a Comment