- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 12:12 AM
i tried in following way but when i RUN report 0 records where displaying, when i run same script in background script i am getting desired out put after printing. Please suggest.
please find my screen shot and script as below
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 01:38 AM
Just to reiterate: you only call scriptIncludeName().methodName() if you have defined a class for your script include. Deepthi, you have written a classless script include so you need to call it as you were:
javascript: getDupes()
To confirm, you definitely need to have the client callable box ticked in order to call this in a report condition.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 12:17 AM
Hi,
please refer to the following threads, you will find useful information for achieve it:
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 12:20 AM
hi alberto, i have seen that links and followed same way, but i need to modify script include probably can u check once script include
function getDupes(){
var dupRecords = [];
var gaDupCheck1 = new GlideAggregate('cmdb_ci');
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;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 12:32 AM
The code seems okay, you have to change the condition in the report:
javascript: new ScriptIncludeName().getDupes();
Please try this.
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2019 12:36 AM
Hi alberto ,
yes i changed to ( javascript: new getDupes().dupRecords(); )
but still facing same and i am getting 0 records, pls suggest
I want to get duplicate serial number cmdb_ci_computer records in report