Tuesday, March 16, 2021

Build queries with QueryExpression || Use the QueryExpression class in Dynamics 365

Build queries with QueryExpression:

1. A query expression is used for single-object searches. For example, you can create a search to return all accounts that match certain search criteria. 

2. The QueryBase class is the base class for query expressions. There are three derived classes: QueryExpressionQueryByAttribute, and FetchExpression

  • The QueryExpression the class supports complex queries. 
  • The QueryByAttribute class is a simple means to search for entities where attributes match specified values.
  • The third derived class, FetchExpression is used with FetchXML, the proprietary Dataverse query language, can be used to perform some queries by using XML-based queries.
Query expressions are used in methods that retrieve more than one record, such as the IOrganizationService.RetrieveMultiple method.