How to Display results from a script in a table (or similar)

riaz_mansuri
Kilo Guru

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

1 ACCEPTED SOLUTION

Please replace 28 line with </li>.



Also, I agree with Kalai on this.


View solution in original post

14 REPLIES 14

Hi Kalairasan - Good point however this is to tackle duplicate Asset Stickers. We now have no duplicate stickers so just need a clear up on the ones in the system.



The field in SNOW automatically pulls the number from SCCM when the machine is being built.


From your comment, are you wishing for a one time job? If that is the case, creating a UI page doesn't make any sense.


Hiyah - All i need is a simple list which shows the duplicate asset numbers that the team can work through.



Once we clear these up the list becomes redundant



I do see your point however we only have a collection of duplicate asset numbers which we just need to easily show and work through



Thanks,


Riaz


Even if that is the case, you should rather be creating a report rather than a UI page. You can easily add that to a dashboard or share them between team or even schedule them as email.



Well anyways, its your decision and not my to take. Good luck.


You have a good point - my scripting skills are limited so am just trying to make it simple.



If I can get this as a report with some fields that would be great. You raise some good points...