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...