Validate FetchXml by using ValidateFetchXmlExpression WebAPI function in the script

InogicDyn365CE2 years ago9 Views


Introduction:

In a recent project, we retrieved Dynamics 365 CRM data using WebAPI and fetchXml expressions. In most cases, we create fetchXml expressions, where we add attributes and filter conditions dynamically in the fetchXml.  When we execute our dynamically created fetchXml expressions, it fails with  different error messages. Here we had come across a requirement where we needed to validate the fetchXml expressions to get the proper error message before calling the retrieve WebAPI function. We had achieved this by using Dynamics 365 CRM ValidateFetchXmlExpression WebAPI function.

Please find the ValidateFetchXmlExpression WebAPI function example below, where we have passed fetchXml as input parameter with the wrong attribute name (testfield).

var fetchXml="<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">"+

'<entity name="account">'+

'<attribute name="name" />'+

'<attribute name="testfield" />'+

'<attribute...



Source link

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
February 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28   
« Jan   Mar »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...