Validate FetchXml by using ValidateFetchXmlExpression WebAPI function in the script

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

More About This Author

Inogic
Inogic is one of the leading Microsoft Dynamics 365 ISV since 10+ years. Its flagship product Maplytics™ is a market leading certified (CfMD) geo-analytical mapping app. Maplytics empowers Dynamics CRM users across industries with the power of geographical data visualization, route optimization and along the route search with turn-by-turn directions, appointment planner, locational search by radius and shapes with drill-down filters and color-coded pushpins, heat maps, shape layers & territory management.
 
Inogic is renowned for its high quality and low-cost offshore development services and productivity apps like InoLink: QuickBooks + Dynamics CRM, User Adoption Monitor, Attach2Dynamics, Alerts4Dynamics Click2Export, Click2Clone, Kanban Board, SharePoint Security Sync, Lead Automation & Distribution, Map My Relationships, Auto Tax Calculator, Subscription and Recurring Billing and Marketing4Dynamics.

Author: Inogic

Inogic is one of the leading Microsoft Dynamics 365 ISV since 10+ years. Its flagship product Maplytics™ is a market leading certified (CfMD) geo-analytical mapping app. Maplytics empowers Dynamics CRM users across industries with the power of geographical data visualization, route optimization and along the route search with turn-by-turn directions, appointment planner, locational search by radius and shapes with drill-down filters and color-coded pushpins, heat maps, shape layers & territory management.   Inogic is renowned for its high quality and low-cost offshore development services and productivity apps like InoLink: QuickBooks + Dynamics CRM, User Adoption Monitor, Attach2Dynamics, Alerts4Dynamics Click2Export, Click2Clone, Kanban Board, SharePoint Security Sync, Lead Automation & Distribution, Map My Relationships, Auto Tax Calculator, Subscription and Recurring Billing and Marketing4Dynamics.

Share This Post On
Share via
Copy link
Powered by Social Snap