- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 11:01 PM
Hi guys,
How can I print each value in the list in a new line?
var ci_list = [];
var gr = new GlideRecord('incident');
gr.addEncodedQuery('sys_created_by=azure_user^cmdb_ciISNOTEMPTY^business_serviceISEMPTY');
gr.query();
while (gr.next()) {
var rel = new GlideRecord('cmdb_rel_ci');
rel.addQuery('child', gr.cmdb_ci.toString());
rel.query();
if (!rel.next()) {
var ci = gr.getDisplayValue('cmdb_ci');
ci_list.push(gr.cmdb_ci.name);
}
}
var uniqueCIs = new ArrayUtil().unique(ci_list);
for (var i = 0; i < uniqueCIs.length; i++) {
template.print(uniqueCIs[i] + ', ');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 11:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 11:05 PM
Hi, try to use
template.print("\n"+uniqueCIs[i] +"\n");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 11:22 PM
not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 11:10 PM
Hello
just replace this line
template.print(uniqueCIs[i] + '\n');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 11:23 PM
not working