Microsoft Dynamics 365(CRM) Tips and Tricks » Fetch XML;Query Expressionhttps://www.inogic.com/blog
By InogicMon, 19 Nov 2018 12:52:14 +0000en-UShourly1http://wordpress.org/?v=4.0How to get the Total Results returned Record Count for a given queryhttps://www.inogic.com/blog/2011/05/how-to-get-the-total-results-returned-record-count-for-a-given-query/
https://www.inogic.com/blog/2011/05/how-to-get-the-total-results-returned-record-count-for-a-given-query/#commentsMon, 30 May 2011 05:58:00 +0000http://www.inogic.com/blog/?p=101Read More »]]>In CRM2011 it is now possible to get the Total count of records returned by a query using Fetch XML.

Using Query expression:

You can set the ReturnTotalRecordCount property to True.

Using FetchXml:

You can set the same property as shown below.

This can be helpful to show Record 1 of kind of status labels.

Hope this helps!

]]>https://www.inogic.com/blog/2011/05/how-to-get-the-total-results-returned-record-count-for-a-given-query/feed/0FetchXML v/s QueryExpressionhttps://www.inogic.com/blog/2010/04/fetchxml-vs-queryexpression/
https://www.inogic.com/blog/2010/04/fetchxml-vs-queryexpression/#commentsFri, 09 Apr 2010 07:25:00 +0000http://www.inogic.com/blog/?p=146Read More »]]>These are the two distinct ways that you can query CRM using CRM SDK to retrieve the required information.

QueryExpression is the mostly commonly used way for querying information in CRM. Probably because it uses the object oriented style of coding and so you have distinct classes for query, condition, columns etc. Youhave intellisense to support you when writing a query using QueryExpression.

However, it has its own limitations, one of them being the inability to provide a column of a linked entity to be returned as the query result. This perhaps because the Query Expression would return a dynamic entity or a strongly typed base entity and so it is unable to return columns of related entity.

This is however possible using FetchXML. FetchXML requires the query to be specified in XML format and the resultset is returned in XML format as well. This allows FetchXML to return related entity columns as well as this is just another node in the xml doc.

The above select query can written as follows using FetchXML

Note: CRM Views allow you to select columns of related entity to be displayed in the view… how do you think they do it??? FectchXML ofcourse. The query of the view created is stored as a FetchXML query in the SavedQuery entity.

CRM also provides the following messages to convert FetchXML to QueryExpression and vice versa.

Note again, if you are to convert a FetchXML that has select columns specified from related entity, to Query Expression, the related entity columns are not included in the QueryExpression columns list.