Random Musings

June 3, 2009

FetchXml To QueryExpression

Filed under: Dynamics CRM — haditeo @ 9:01 pm

In order to build a complex queries, usually i create an advanced find and “obtains” the fetch xml string. To complement this, i use the FetchXmlToQueryExpression request to convert this fetch xml string into a Query Expression object

FetchXmlToQueryExpressionRequest request = new FetchXmlToQueryExpressionRequest(); 
request.FetchXml = "Insert the valid Fetch Xml String here";
FetchXmlToQueryExpressionResponse response = (FetchXmlToQueryExpressionResponse) crmService.Execute(request);

QueryExpression query = response.Query;

Usually i debugged the query contents and then manually construct the QueryExpression objects. So FetchXmlToQueryExpressionRequest here is used to help me construct the QueryExpression easily

Advertisements

1 Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: