- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 02:40 AM
Hi,
I have a script which runs fine and displays the results well in the scripts Background.
How do I display the script results in service now as a page and have this script run daily?
var dupRecords = [];
var gaDupCheck1 = new GlideAggregate('cmdb_ci_computer');
gaDupCheck1.addQuery('model_category','laptop');
gaDupCheck1.addAggregate('COUNT', 'asset_tag');
gaDupCheck1.groupBy('asset_tag');
gaDupCheck1.addHaving('COUNT', '>', 1);
gaDupCheck1.query();
while (gaDupCheck1.next()) {
dupRecords.push(gaDupCheck1.asset_tag.toString());
}
gs.print(dupRecords);
Does not have to be anything fancy as long as it displays the results.
Thanks,
Riaz
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 04:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 04:17 AM
Please replace 28 line with </li>.
Also, I agree with Kalai on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 04:27 AM
Top Job!! Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 04:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 08:24 AM
Hi Riaz,
gaDupCheck1 is the gliderecord object which is carrying all fields information in it. So you can just fetch out any field's value you need here.
${gaDupCheck1.asset_tag} - ${gaDupCheck1.newFieldName}C
Replace newFieldName in script with your field name.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 04:13 AM
Do you not wish to address the root cause and stop adding duplicates by making asset_tag unique instead?
Jobs are usually for one time action, reminders etc. But I feel here, you should be addressing the root cause rather than adding more technical debt.