Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)
Answered

FetchXML get total count of record

(0) ShareShare
ReportReport
Posted on by 2,397

Hi, by default, Fetchxml gets 5000 results, what if the result is after 5000, I have to call multiple times? 

*This post is locked for comments

  • Kenneth Leong Profile Picture
    Kenneth Leong 360 on at
    RE: FetchXML get total count of record

    True that linq to crm will retrieve all records even if it's > 5000. It's better than fetchxml in the sense that you don't have to run a while loop, 5000 at a time to get everything. Codes is cleaner.

    But do bear in mind, that in the background, crm is running a 5000 at a time query against sql.

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: FetchXML get total count of record

    You can do it with latebound (if we are talking about linq), just need to follow a workaround descrbied here:

    community.dynamics.com/.../querying-crm-data-with-linq

  • sdnd2000 Profile Picture
    sdnd2000 2,397 on at
    RE: FetchXML get total count of record

    yes, I understand, I have to use earlybound

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: FetchXML get total count of record

    You can use a paging cookie with Fetch (that link Gopalan provided seems to work fine.. at least today)

    You can use Linq, just keep in mind it'll work slightly differently - I believe it will try to grab all records at once, so this may take a while if you have too many. Also, it will be retrieving all entity attributes (unlike fetch where you can specify which exactly)

  • sdnd2000 Profile Picture
    sdnd2000 2,397 on at
    RE: FetchXML get total count of record

    I can use linq to retrieve all records?

  • Suggested answer
    BadrinathB Profile Picture
    BadrinathB 970 on at
    RE: FetchXML get total count of record

    What is your exact requirement?

    If you have to fetch more than 5k records then you can use either paging concept or update system settings to fetch more record.

    The below link will help you to understand better.

    www.softchief.com/.../retrieve-more-than-5000-records-in-dynamics-crm

  • Gee Bee Profile Picture
    Gee Bee 11,397 on at
    RE: FetchXML get total count of record

    msdn.microsoft.com/.../gg328046.aspx

  • Suggested answer
    Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: FetchXML get total count of record

    If you download XRMToolBox and download the Record Counter plugin :)

    5775.Screenshot_5F00_2.png

  • Brekh Profile Picture
    Brekh 190 on at
    RE: FetchXML get total count of record

    Hi,

    You can check for Morerecords property from the resultset of Entity collection and use pagingCookie. Below link shows the example.

    stackoverflow.com/.../how-to-fetch-more-than-5000-entities-from-crm

    Hope this helps.

  • sdnd2000 Profile Picture
    sdnd2000 2,397 on at
    RE: FetchXML get total count of record

    The link doesn't work

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans