why array printing one number multiple times instead of printing every record number under query??
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 02:30 AM - edited 05-07-2024 02:31 AM
var abc = [];
var gr = new GlideRecord('incident');
gr.addEncodedQuery('caller_id=77ad8176731313005754660c4cf6a7de');
gr.query();
while(gr.next()){
abc.push(gr.number);
}
gs.print(abc);
can anyone give me explanation in laymen terms??
5 REPLIES 5

Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 02:58 AM
Hi @KM SN ,
I tried your problem in my PDI and it works for me please check below
var abc = [];
var gr = new GlideRecord('incident');
gr.addEncodedQuery('caller_id=77ad8176731313005754660c4cf6a7de');
gr.query();
while(gr.next()){
abc.push(gr.number.toString());
}
gs.print(abc);
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak