When do we use next(), hasNext() and _next()

chanikya
Kilo Sage

Hi All,

I have 10 records only on whole table , now I want to update records So 

When do we use next(), hasNext() and _next()

1 ACCEPTED SOLUTION

Hi,

just to check if there is any record satisfying the query

hasNext() - does not actually go to that record but just tells true/false is there is any record matching the query

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

25 REPLIES 25

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

since you want to update the records you can use next() method

next() - goes to every record

hasNext() - tells whether there is record satisfying the query

_next() - used when your table field/column name as "name"

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

at script side, what case we use hasNext();?

Hi,

just to check if there is any record satisfying the query

hasNext() - does not actually go to that record but just tells true/false is there is any record matching the query

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur, 

Kindly help me for understanding.

if there is an single record in whole table , then can we update that record using with hasNext() in script side.