Altering No of records loaded programmatically

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have several use cases where I want to limit the number of Accounts and Sales Records loaded from a model initially but then allow a User to be able to change these numbers (without altering filters) .. if there any way to change the default number.
Photo of David Forder

David Forder

  • 2,084 Points 2k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Good question.

For clarity, are you wanting to first bring in only 20 records on a model at page load but then have the user change the number from 20 to 40 or 60 or whatever? Is that what you're asking? If so, could you provide the use case as well? Knowing the business need can sometimes present an alternative method.
Photo of Jannik Gysi

Jannik Gysi

  • 594 Points 500 badge 2x thumb
Hi David

With JavaScript you're able to get the model. On the model theres a property called recordsLimit. If you change that and afterwards query the model, it will load the additional records.

Cheers
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,674 Points 20k badge 2x thumb
Hmmm ... the best UX is to have the recordsLimit value be controlled and set prior to page load by the user. That's not something currently possible without some level of hacking.

Jannik's method works just fine.

I'm assuming it's per user and the # of records to load on page load.

Then, since there's no place to store this value at the moment, then I'd create a field on the user record, update/add a page for user preferences, load CurrentUser Model and subsequently create In-Line javascript to set RecordsLimit and query the model. Janky, but your request doesn't have OOB option. :D
Photo of David Forder

David Forder

  • 2,084 Points 2k badge 2x thumb
Thanks guys .. got it. I always limit the number of records upfront on a load but when it comes to drilling down on aggregate models it would be useful to remove this limit on occasions from the UI

Appreciate the help

David