Dynamics CRM FetchXML with new Microsoft Dynamics CRM V9 API

Using dynamics CRM FetchXML with Xrm.WebApi.retrieveMultipleRecords in Dynamics 365 V9

Dynamics Web API is a tool to use the CRM functionality of Dynamics 365 creating a much easier way for developers to get information. With the API, you can use HTTP requests to pull data from Dynamics CRM with the use of order, filter, and select depending on scenarios. The new Dynamics CRM API also gives you the option of pushing dynamics CRM FetchXML into the request for scenarios.

Learn more about our Dynamics 365 Offerings 

Learn More


The Xrm.WebApi.retrieveMultipleRecords method allows to retrieve records from FetchXML, but MSDN only gives examples to use this with the OData query options. However, new Dynamics CRM API allows the developers to use fetchXML queries.

 

Extract FetchXML

We can extract dynamics CRM FetchXML from advanced find.

 

Advanced Find For FetchXML in Dynamics CRM

 

Below is extracted Dynamics CRM FetchXML from Advanced Find.

 

FetchXML Dynamics CRM

 

Creating JS for Execution

We need to use the encodeURIComponent javascript function as we need to supply it through Dynamics CRM API. After that, we need to prepend the dynamics CRM FetchXML in the query.

 

Create JS Dynamics CRM

 

We have the query ready to send and get the desired results.

 

FetchXML Microsoft Dynamics CRM

 

Explore our Dynamics 365 Offerings 

Learn More

There is a limitation of 2047 characters in a query as Internet Explorer and Edge only support up to that in a URL, so very large dynamics CRM FetchXML queries will cause an error in those browsers.

Hope this will be helpful.

Conclusion

So, we can use Xrm.WebApi.retrieveMultipleRecords Dynamics 365 API function in JS to retrieve multiple records from FetchXML. If you have any questions or queries, leave a comment below. You can also connect with our BOLDEnthusiasts by clicking here.