Skip to main content

Notifications

Service | Customer Service, Contact Center, Fie...
Suggested answer

5000 records limitation for Fetch XML on lookup

Posted on by 10

Hi,

There are 5000 records limitation for  Fetch XML on lookup  , we have this requirement how to over come this limitation in D365 please help if someone have solved this in past.

Regards

Kusum

  • Suggested answer
    CRMJetty Profile Picture
    CRMJetty 3,508 on at
    RE: 5000 records limitation for Fetch XML on lookup

    Hello,

    refer this articles,

    http://www.kingswaysoft.com/blog/2013/06/18/Limitations-with-CRM-FetchXML

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/275989/how-to-get-more-than-5000-records-using-fetchxml-query

    https://www.xspdf.com/resolution/52737866.html

    I hope it helps,

    Thanks.

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365

  • Suggested answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: 5000 records limitation for Fetch XML on lookup

    Hi Kusum,

    The whole story and solution is here : pravinpawarweb.wordpress.com/.../

    With the help of "PagingCookie" you can retrieve more than 5000 records using fetchexpression

  • Suggested answer
    RE: 5000 records limitation for Fetch XML on lookup

    Dear Partner,

    QueryExpression in CRM returns only up to 5000 records only. If you want to retrieve the entity records count that has more than 5000 records then need to use FetchExpression. Fetch expression uses the fetch XML query with aggregate operator.

    Below is the same code to retrieve the records count from Account:

    string fetch = @”<fetch mapping=’logical’ distinct=’false’ aggregate=’true’>

    <entity name=’contact’>

    <attribute name=’contactid’ alias=’recordcount’ aggregate=’count’/>

    </entity>

    </fetch>”;

     FetchExpression fetchquery = new FetchExpression(fetch);

    var collection= CrmOrganizationService.RetrieveMultiple(fetchquery);

    pastedimage1609945965918v1.png

    Note:

    FetXML query returns up to 50000 records only. If we have more than 50K records then need to use paging concept to get all records count.

    Did I answer your question? Please consider to mark my post as a solution to help others.

     

    Regards,

    Mohamed Sanuj Basheer

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans