Summary:
This article describes the use case for Query operations of Microsoft Dynamics CRM 365 Connector with the $expand function in the on-premise
Prerequisites:
• 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
Contents:
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 https://www.odata.org/getting-started/basic-tutorial/#expand
Steps:
-
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
-
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
-
To create the CCS, choose any folder and Right-click to choose New → Cloud Connector Service Option
- Enter any name for the CCS as per user requirements, Example: queryAccounts
- Now choose the Microsoft Dynamics 365 CRM option from the available Connectors list and click Next
- Choose the Connection alias from the available Connection Pool list and click Finish
- Now click Recourse Name option as mentioned in the below screenshot
- Then choose the Query resource from the list of resources and click Next
- 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
- 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 Learn
- Now we will run the queryAccounts CCS
- The next screen shows all the request parameters. First, we will run this service without specifying any parameters, click OK
- 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
- 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
Results: