Microsoft Dynamics CRM 365 Query operations with $expand option


This article describes the use case for Query operations of Microsoft Dynamics CRM 365 Connector with the $expand function in the on-premise


• The user needs to have a working account for Microsoft Azure Active Directory and a Microsoft Dynamics CRM 365 license to access the API

• License for the Integration server 10.3 or above


We will analyze the various options of querying the business objects, Example: $expand & filters in the Microsoft Dynamics CRM 365 using Query Operation service in the Connector. More information can be found at Basic Tutorial · OData - the Best Way to REST


  1. User needs to start the Integrations Server and open Designer along with the latest Microsoft Dynamics CRM 365 package installed, also the Connection should be established

  2. Once the Server gets started, the user needs to create the CCS (cloud connector service) for the query operation available in the Connector. In this example, we will query the Accounts business object

  3. To create the CCS, choose any folder and Right-click to choose New → Cloud Connector Service Option

  1. Enter any name for the CCS as per user requirements, Example: queryAccounts

  1. Now choose the Microsoft Dynamics 365 CRM option from the available Connectors list and click Next

  1. Choose the Connection alias from the available Connection Pool list and click Finish

  1. Now click Recourse Name option as mentioned in the below screenshot

  1. Then choose the Query resource from the list of resources and click Next

  1. All the business objects will appear in the next window, here we will choose the accounts business object to query the accounts. Choose accounts and click Next

  1. In the next screen, the user will find all the fields list with respect to the accounts business object. Here user can choose the fields required to be seen in the response. Example: Choose name, account id & $expand and then click Finish & Save

Choose accountid:

Choose name:

Choose $expand: Related entities to be included inline in the response. More information about the $expand can be found at Using $select, $expand, and $value in ASP.NET Web API 2 OData - ASP.NET 4.x | Microsoft Docs

  1. Now we will run the queryAccounts CCS

  1. The next screen shows all the request parameters. First, we will run this service without specifying any parameters, click OK

  1. This service executes successfully, the user will get all the account details present in the tenant with the fields selected in the above step 10

  1. Now we will query based on the request parameters. Rerun this service again, this time we will fetch the information about the particular accountid (not all the accounts). Example: Specify the filter option

filter: accountid eq 4ab4a12a-1f3e-e911-a960-000d3a1f716c