Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
I have 5000+ account records to work with. I'm trying to create a nice paginated list of these accounts.
I've seen the documentation here: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/query-data-web-api but it seems a little limited.
I can set the number of items per page easily enough with the header Prefer: odata.maxpagesize=50
This provides then a @odata.nextLink to get the next page. Seems simple enough.
What if I want to skip ahead to page 5?
Looking at the query string in nextLink, I see it has the page number in a cookie value.
I've found I can do a request to accounts?$select=name&$skiptoken=<cookie pagenumber="5"> and this seems to work.
But is this right? It feels dirty, is there a better way?
Also, there's a few more basic details missing, like total number of pages. I can get a count of total accounts (and calculate the total number of pages) with $count=true but this is limited to 5000, so it won't be accurate. How would I skip to the last page in this scenario?
Any help in this regard would be greatly appreciated Am I on the right track? Is there some documentation somewhere I'm missing?
My experience is on the API side but, my impression is that the end-of-list is unknowable until you get there. You notice that the navigation on the bottom right of the list has a "home" arrow but no "end" one -- just next.
I can do a little bit of "cheating", I can work out the real count of accounts by not setting a max page size, and just paging through until there's no results. It's not too lengthy to to do, and I can cache this result for a while, run the count every once in a while on a cron job, so there's no slow down for the end user, and they get a "last page" and "total results" number. It's really not ideal though. There is a potential that the last page changes before the cache updates. There must be a nice way to do this.
you can, of course, also run an aggregate fetch to get a count and do some math with it.
Do you have an example on how this count can be achieved using aggregate? I'm having trouble understanding how this can be done reading the docs linked above.
Edit: Ok, found it reading through these docs: http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs01/odata-data-aggregation-ext-v4.0-cs01.html#_Toc378326295
You can do accounts?$apply=aggregate($count as AccountsCount) however this query also has a limit, which is 50000. I have more accounts than that. Luckily I can filter this by the ones I need for this list, which should lower the total to less than 10000, but obviously if this grows to more than 50000, this solution will no longer be valid. Is there no way to retrieve the real count? There must be.
Business Applications communities