Retrieve data using same data type fields from different entities | CloudFronts

Retrieve data using same data type fields from different entities

Posted On April 28, 2017 by Subhash Mahato Posted in


We have various methods to query CRM like, “query expression”, “fetch expression” and “LINQ”. If we want to query data of two different entities, then we should have relationship between entities otherwise you will not get data. In case you want to process data of two different entities which are not related to each other then what to do.

We can achieve this using fetch Expression in with the common field data type.


We had a requirement where we wanted to get the data from two different entities which were not related to each other but both of them had common field Email Address. So we can query the CRM using Fetch expression by providing from field and to field which will connect to each other.


To demonstrate this how it works I have tested it with account and contact entities as an example. We are testing it with “email address”. To execute this query XRM tool box is used. You can download it from given link




<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
    <entity name="contact" >
        <attribute name="fullname" />
        <attribute name="emailaddress1" />
        <order attribute="fullname" descending="false" />
        <link-entity name="account" from="emailaddress1" to="emailaddress1" alias="Account" >
            <attribute name="emailaddress1" />
            <attribute name="name" />

As you can see that we have linked contact and account on the basis of emailaddress1. Once you execute the query you will have all the records which are related to each other with same email id

As you can see there are more records matching with same email id on account and contact. So it returns all the records with the matching email id.


You can query CRM data of two different entities using the same data type fields.

Share Story :

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.