- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2022 10:16 AM
Requirement: I need to retrieve the list of records through Gliderecord. I used below code but it is only retrieving the first record in the list.

Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2022 10:20 AM
Hello
please change the if to while
also if you want all names like this
var arr=[];
var obj2 = new GlideRecord('cmdb_rel_ci');
obj2.addEncodedQuery('yourencodedquery');
obj.query();
while(obj.next())
{
arr.push(obj2.child.getDisplayValue());
}
gs.info('My object names'+arr.toString)
PLEASE MARK MY ANSWER CORRECT IF IT HELPS YOU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2022 10:50 AM
Hi,
I have defined sysid2 in my actual code.
i also tried declaring 'names' as array outside of while loop and kept 'return' outside of while loop.
...still getting only one record.
