Skip to main content

Notifications

Power Pages - Customize & Extend
Unanswered

Fetching more than 5000 records

Posted on by 10

Hi All,

 

I am trying to fetch a list of assets to show in a Power Page, currently i am using a fetchxml to get the records, untill now everything is fine since i have about 2800 assets. But the number of assets is growing. I want to fetch them all because i am creating counts on the number of assets of a specific type and combine that with a lot of extra data like locations and so on. Once i fetched the assets i convert them to a json and then i use JS to add some logic.

 

I know that the max number of items you can fetch in one go is 5000 records. I have read some post online but i am struggeling a bit.

 

Here is an example script:

 

 


{% fetchxml CustomerAssets %}
<fetch >
  <entity name="msdyn_customerasset">
    <attribute name="msdyn_name" alias="CustomerAsset" />
  </entity>
</fetch>
{% endfetchxml %}
 
<script>
// Load all assets into an array
let customerAssets = [
  {%- for CustomerAssets in CustomerAssets.results.entities -%}

  { 
    "CustomerAsset": '{{ CustomerAssets["CustomerAsset"] }}', 
  },
  {% endfor %}
 
];
 

 

The above script has been simplified there are a couple of link entities in there as well.

 

 

In preperation for having more that 5k assets, how could i change this script to do multiple rounds of fetching?

 

Regards,

 

Meton

Categories:
  • oliver.rodrigues Profile Picture
    oliver.rodrigues 8,830 on at
    Re: Fetching more than 5000 records

    hi, nothing wrong using fetch, but you seem to be returning it as a JSON anyway, have you considered using the Read API?

    Portals read operations using the Web API | Microsoft Learn

     

    This limit is set on the Dataverse, you can always use Paging to fetch more results, but if I may ask.. why are you retrieving 2000 or even 5000 to be displayed in a page? This sounds very "un-performatic".

     

    have you considered adding filters to your query? 

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

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,651

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,727

Leaderboard

Featured topics