Posted in CRM, Plugin

Dynamics CRM 2016 – Querying Data with QueryExpression.

Dynamics CRM 2016 – Querying Data with QueryExpression.

QueryExpression is useful in scenarios where you want to return multiple entities that match a certain criteria. It lets you specify which fields you want to have returned (from the specified entity type or any related entity) as part of the query result in order to improve performance. Developers can also control the order in which records are returned.

To Know the power of QueryExpression, let’s take a look at a few examples:

Example 1 – Simple query with two conditions for a single entity

Scenario: Retrieve the First Name, Last Name, and Email Address for Contacts that have the Job Title field set and live in Auckland city

Dynamics CRM 2011 Querying Data with QueryExpression

Example 2 – Complex query with multiple conditions across two related entities

Scenario: Retrieve the First Name, Last Name, and Email Address for Contacts that are “Sales Managers” and the Parent Customer is based in Auckland or Wellington city

Dynamics CRM 2011 Querying Data with QueryExpression

Example 3 – Simple query with OrderExpression

Scenario: Retrieve all Accounts in the system and order by the date created (most recent first)

Dynamics CRM 2011 Querying Data with QueryExpression

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s