Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Plugin - Which query to use - fetchxml or Linq?

(0) ShareShare
ReportReport
Posted on by 1,577

Hello,

I am seeking some advice. - I am writing a CRM (Dynamics365 online) Plugin on pre-Create of a Lead.

Central to this is a (retrievemultiple) query to find out if leads already exist in CRM with the same details (email, name) as the incoming Lead.

I will then use attribute-values from the entities in this resultset in order to update the new/incoming Lead.

In terms of speed/efficiency, future-proofing and (less-so) ease of use, would you recommend I use fetchxml for this query, or Linq, or any other alternative?

Also, am I better to use late or early-binding - is there any performance advantage in either?

Many thanks for advice.

- Seamus

  • Verified answer
    Charles Abi Khirs Profile Picture
    3,569 on at
    RE: Plugin - Which query to use - fetchxml or Linq?

    Hello,

    I don't think there is better statement than the other, because they are all reflected as SQL statements on the database level. However, the way you write your query and what you want to achieve with it might impact the performance, like aggregation, retrieving all columns instead of only the needed ones, or not using linked entities when needed.

    As for early bound and late bound, it doesn't impact the performance because it is a way of writing the code where I prefer to use early bound because it gives you the intellisence and you can avoid the typo errors that can be present in using late bound.

  • Seamus Profile Picture
    1,577 on at
    RE: Plugin - Which query to use - fetchxml or Linq?

    Thanks Ramprakash. So, fetchxml is the "worst"? Any advice of later or early binding, or is there no difference?

  • Verified answer
    Ram Prakash Profile Picture
    2,287 on at
    RE: Plugin - Which query to use - fetchxml or Linq?

    Hi Seamus,

    Please find the performance order which we can use for Retrieve Multiple

    1.QueryExpression

    2.Linq

    3.Fetchxml

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,110 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans