To Query MS CRM DB there are the two distinct ways.
- Using QueryExpression
- Using FetchXML
Limitation of the QueryExpression is , If you are Querying CRM DB using QueryExpression you cannot able to set Related Entity columns as filter criteria to return the Query Result.
Where as using FetchXML , you can set the Related Entity columns in filter criteria to return the Query Result.
Note: CRM also provides the following messages to convert FetchXML to QueryExpression and vice versa.
– FetchXmlToQueryExpression : Converts from FetchXML to query expression.
– QueryExpressionToFetchXml : Converts from query expression to FetchXML.
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.