the ins and outs of GlideRecord.next()

hosmmz
Tera Contributor

Hello,

 

can someone explain to me what does GlideRecord.next() mean and what it's function, please? 

 

 

Thanks

2 ACCEPTED SOLUTIONS

Tony Chatfield1
Kilo Patron

Hi, next() simply iterates through the results\records returned by the glide query.
GlideRecord | ServiceNow Developers

hasNext() checks to see if there are any more records in the returned query result

GlideRecord | ServiceNow Developers

View solution in original post

AshishKM
Kilo Patron
Kilo Patron

Hi @hosmmz,

 

next()

Moves to the next record in the result set of GlideRecord object, initially when we apply query() method it return the table data in row/column based on table structure and applied filter condition. the next() method iterate over result set and check if there is next record exist , if exist then result is true else false.
 
hasNext() - checks, if there are any more records in the of GlideRecord's result-set object.

 

You can refer the developer portal

 

-Thanks

AshishKMishra

 

 

 

 

 

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

View solution in original post

4 REPLIES 4

Tony Chatfield1
Kilo Patron

Hi, next() simply iterates through the results\records returned by the glide query.
GlideRecord | ServiceNow Developers

hasNext() checks to see if there are any more records in the returned query result

GlideRecord | ServiceNow Developers

Thank you!

AshishKM
Kilo Patron
Kilo Patron

Hi @hosmmz,

 

next()

Moves to the next record in the result set of GlideRecord object, initially when we apply query() method it return the table data in row/column based on table structure and applied filter condition. the next() method iterate over result set and check if there is next record exist , if exist then result is true else false.
 
hasNext() - checks, if there are any more records in the of GlideRecord's result-set object.

 

You can refer the developer portal

 

-Thanks

AshishKMishra

 

 

 

 

 

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

hosmmz
Tera Contributor

Thank you!