To Query MS CRM DB there are the two distinct ways.
- Using QueryExpression
- Using FetchXML
Limitation of the QueryExpression is , If you are Querying CRM DB using QueryExpression you cannot able to set Related Entity columns as filter criteria or
to provide a column of a linked entity to be returned as the query result.
So you are not able to execute a query similar to the following
Select Opportunity.name, Opportunity.estimatedvalue, Account.address1_city from FilteredOpportunity Opportunity
Inner join
FilteredAccount Account on Opportunity.customerid = Account.accountis
Where account.address1_country = “US”
Also you cannot use aggregate functions in query expression.
In Fetch Xml Query you can retrieve the columns of related entity and you can set the related entity columns as filter criteria and you can use the aggregate functions in Fetch Xml query.
Query Expression can only be used in server side language i.e C#.
But Fetch Xml query can only be used in SSRS , JavaScript(Webapi),C#.
But in performance Query Expression is better than Fetch Xml query.
FilteredAccount Account on Opportunity.customerid = Account.accountis
Where account.address1_country = “US”
Nice blog
ReplyDeleteTo more info look into below
https://prudvihub.blogspot.com/2020/09/fetchxml-and-queryexpression-in.html?m=1