Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications


Using FetchXML with the New Dynamics Web API

Post Author: Joe D365 |

The new Dynamics Web API is a new and amazing tool built into 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 your Dynamics environment with the power to order, filter, and select as you see fit. However, what if your call is a bit more detailed than something as simple as needing a contact's address with this specific GUID? The API also gives you the option of pushing fetch XML into the request for cases such as these.

Let's look at an example: I need all accounts where the primary contact is myself. Simply enough we would construct a call with "'clientUrl'/api/data/v8.2/accounts?$filter= _primarycontactid_value eq (contact GUID)". Easy!

dynamics web api

Now, what if it is a bit more detailed? We need all accounts where the primary contact is myself and another specific contact is another contact on a child account. So, we need to look at all the child accounts, then all the contacts on those accounts, and check to see if that contact is on that account.

Doing so with a single API call would prove to be very difficult for us, but we can push fetch XML from advanced find into the API. A call would look like so: ‘clientURL’/api/data/v8.2/accounts?fetchXml=’encoded fetch XML’.

dynamics web api

As you can see, with the option of using FetchXML we can get a lot more detailed if need be with linking multiple entities and using those entities with filters as well. It's a pretty neat tool!

For the latest news and helpful tips for using Dynamics 365, check out our blog!

Happy Dynamics 365'ing!

By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends