Dynamics Monster Limited

By: Pedro | February 02, 2015

Often when developing high scale projects, and when performance is very crucial and critical if needed any aggregation function on a Plugin, Custom Workflow Activity or even a custom Application when retrieving data from crm, we should use Fetch XML.
When i have to do that, usually i have two options use an advanced find to get the xml (Button that says Download Fetch XML), or we can use a method from the SDK to do the same, please see the below example:

Where queryExpression is a QueryExpression type.

var conversionRequest = new QueryExpressionToFetchXmlRequest
Query = queryExpression
var conversionResponse =
// Use the converted query to make a retrieve multip...

By: Pedro | January 27, 2015

Often, a CRM consultant has to develop some custom code to work with large result sets, below is an example that it can be found in the SDK using LINQ.

I will do my tests as well to see the best option to use (Linq, QueryExpression and Fetch) in terms of performance and time to develop as well, however below is the LINQexample:

The following example shows how to page the results of a LINQ query by using the Take and Skip operators:

int pageSize = 5;
var accountsByPage = (from a in svcContext.AccountSet
                      select new Account
                       Name = a.Name,
System.Console.WriteLine("Skip 10 accounts, then Take 5 accounts");