- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 01:01 AM
hi
i have checked ur code is correct run in background script
var dupRecords = [];
var gaDupCheck1 = new GlideAggregate('cmdb_ci_computer');
gaDupCheck1.addQuery('active','true');
gaDupCheck1.addAggregate('COUNT', 'serial_number');
gaDupCheck1.groupBy('serial_number');
gaDupCheck1.addHaving('COUNT', '>', 1);
gaDupCheck1.query();
while (gaDupCheck1.next()) {
dupRecords.push(gaDupCheck1.serial_number.toString());
}
gs.print(dupRecords);
it's giving the value
56WHL71,AEX5635Z0001AC,L3BB911
only mistake this line
javascript : new script_include_name.method_name();
thanq
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 01:07 AM
hi rahul,
pls check below and suggest if some thing wrong in calling script include
my script include as below,
function getDupes(){
var dupRecords = [];
var gaDupCheck1 = new GlideAggregate('cmdb_ci_computer');
gaDupCheck1.addQuery('active','true');
gaDupCheck1.addAggregate('COUNT', 'serial_number');
gaDupCheck1.groupBy('serial_number');
gaDupCheck1.addHaving('COUNT', '>', 1);
gaDupCheck1.query();
while (gaDupCheck1.next()) {
dupRecords.push(gaDupCheck1.serial_number.toString());
}
return dupRecords;
}
i given as below in report
javascript : new getDupes().dupRecords();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 01:12 AM
You only call the script include name and then the function name liek that if you've defined a class for your script inculde. Have a look at the link below, it explains the difference and how and when to use them.
https://community.servicenow.com/community?id=community_blog&sys_id=88bce625dbd0dbc01dcaf3231f9619be
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 01:26 AM
yes,
it's working fine
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 01:38 AM
hi,
it's working or not tell me
Thanks,
Rahul Kumar