- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2020 12:44 PM
Hello!
We're currently working on an issue where we have duplicate assets being created within alm_asset. One asset is created via discovery and the other is by our procurement user. We believed we've fixed the issue where discovery was not identifying the record created by the user and updating that. Now we have clean-up to do for the duplicates.
So far I've identified the duplicates by running this script:
gatherDupes();
function gatherDupes() {
var gr = new GlideAggregate('alm_asset'); //you can do this based on any table in cmdb
gr.addAggregate('COUNT', 'serial_number'); //based on what field
gr.groupBy('serial_number'); //grouping by field
gr.addHaving('COUNT', '>', 1);
gr.query();
while (gr.next()) {
gs.log("Numb of Duplicates: " + gr.getAggregate('COUNT', 'serial_number') + " => " + gr.serial_number);
}
}
Now our question is, what's the best way to clean these records up? Would it be via a fix-script or background script? If so what would that look like since all the fields would need to be merged from record A to record B. Or is there a better best practice in doing this? What about relationships or references for the asset record? i.e. if a user has an asset assigned to them.
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Enterprise Asset Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 07:27 PM
Hello,
Ref,
duplicate record in asset table
remove duplicates from asset table
If answer is helpful please mark correct or helpful!
Thanks,
Pratiksha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 07:27 PM
Hello,
Ref,
duplicate record in asset table
remove duplicates from asset table
If answer is helpful please mark correct or helpful!
Thanks,
Pratiksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2020 07:34 AM
Thank you! This helped!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2020 08:45 AM
You are Welcome!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 08:14 PM
Hello,
You need to write an identification rule to avoid duplication of record in asset table.
Best practise is to write script in a fix script because fix script changes are capture in an update set.
But when you are deleting record via background script so these changes are not capture in update set.
It is difficult to track changes when you are deleting record via background script.
so my suggestion is you need to write fix script to delete duplicate record.
Regards,
Harshal