knowledgecenter-breadcrum

Knowledge Center

01 Jan, 2023

FetchXML vs XML

Posted on 01 Jan, 2023 by Admin, Posted in Dynamics 365 Dataverse

FetchXML vs XML Blogs

FetchXML vs XML

Introduction

If you’re new to Microsoft Dynamics 365 and come across FetchXML, you might assume it’s simply a way to fetch data in an XML document. However, that’s not quite how it works. While XML is typically used for storing and transporting data, in Dynamics 365, “XML” is prefixed with “fetch” to create a new term used for querying data. In this blog post, we’ll explore what FetchXML is and how it differs from standard XML. But before we dive into that, let’s quickly review what XML is and how it’s typically used.

What is XML?

XML (extensible Mark-up Language) is a software and hardware independent tool for storing and transporting data. XML is designed to be self-descriptive which means it describes both its content and structure and it is both human and machine readable. XML tags are not predefined. You must define your own tags. XML is designed to carry data, not to display data. Let’s see an example.


  
    Macaroni and Cheese
    $5.95
    
      Cheesy, gooey, creamy and oh-so-delicious, Macaroni and Cheese.
    
  
  
      Panini Bread
      $7.95
      
          Panini Bread covered with strawberries and whipped cream
      
  

In above example, we can see a breakfast menu contains some information about food like name, price and its description. All tags in it is define by us and each tag containing some data and it is very easy to comprehend.

What is FetchXML?

FetchXML is a proprietary query language that is used in Common Data Service. We call this query language FetchXML because it is used like a SQL statement with XML instead of standard T-SQL. FetchXML is not exactly like XML but it uses XML like structure to query the data.

How it is different than normal XML?

FetchXML is based on a schema, which is an XML document in which, elements of FetchXML are defined and that describes the capabilities of the FetchXML language. Now we can see that the FetchXML isn’t an actual xml, but in fact, it’s a query language which is based on a predefined XML schema.

You can find more information about FetchXML schema here:

https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/fetchxml-schema

Let’s see an example of FetchXML to understand difference between FetchXML and XML.

  
   
       
       
   

Above example is a simple fetchXML query which specify account entity and attributes accountid and name. We can observe that this doesn’t contains any data, but it contains tags which was already define in the schema for the FetchXML query language, which the defines the what data we are fetching, just like a query language like SQL.

You can find more information about FetchXML here:

https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-fetchxml-construct-query

Conclusion

As we have seen what is XML and what is FetchXML and how both are different from each other, we can conclude that the FetchXML isn’t an actual XML which store and carry data, but in fact, it’s a query language which is based on a predefined XML schema.

Comment

This is a Required Field

Loading

Recent Updates

Email Storage Made Easy: Dynamics 365 Space Saving Tips
Blogs
29 Feb, 2024

Email Storage Made Easy: Dynamics 365 Storage Saving Tips

Email Storage Made Easy: Dynamics 365 Storage Saving Tips Introduction Microsoft's latest feature allows you to migrate email descriptions from CRM…

READ MORE
Blogs
28 Feb, 2024

How to enable the enhanced email template editor in Dynamics 365?

How to enable the enhanced email template editor in Dynamics 365? To activate the Enhanced Email Template editor for your…

READ MORE
RCA for ARC Migration Issue
Blogs
28 Feb, 2024

Troubleshooting Convert Rules Import Issue: Entity 'workflow' with ID Does Not Exist error in D365

Troubleshooting Convert Rules Import Issue: Entity 'workflow' with ID Does Not Exist error in D365 Problem Statement We implemented D365 Customer…

READ MORE