Pagination

manasaks
Kilo Contributor

Hi Team ,

                                                I am trying to incorporate pagination for my huge Data.I went through existing solutions but i found a new Pagination solution which i am trying to use.

Link : SN Pro Tips — GlideRecord Pagination - Page through your GlideRecord query

The Script include i am unable to use in my UI page.The output is always null.Can

Written in Processing script. Kindly let me know the error in below code.How to render data from server on UI page.

if(table=="sc_task") {

gs.include('PagedGlideRecord');

var pgr = new PagedGlideRecord(table, 'state=1', 100);

while (pgr.nextPage()) { //Loops until there are no records/pages left.

  //Do some stuff, such as indicate the page number in the UI.

  gs.log("test 2 :"+pgr.getPage(),"page");

}

}

3 REPLIES 3

sethhumphrey
Mega Guru

2 yrs ago so you probably got this fixed or moved on but here's a solution we came up with - 

https://community.servicenow.com/community?id=community_question&sys_id=bdb9f178db129340c310fb651f96...

I hope that's what you're looking for.

Good luck,

Seth

jaheerhattiwale
Mega Sage
Mega Sage

@manasaks Hope you have created the script include.

gs.include('PagedGlideRecord'); line is not needed i think. please comment it and check.

nextPage() function expects callback function.

 

Please check the functionality of script include in scripts background first.

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023