How to find if there are any duplicate records in any table of ServiceNow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2024 07:27 AM
Hi,
Is there a way to find if there are any duplicate records in ServiceNow table?
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2024 07:31 AM
Hi @Community Alums
In SN, every record saved in specific table only , like Inc/ Change / Prb, for this you can use Task table to search but there is not generic way to find the duplicate records. What is your use case?
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2024 07:35 AM - edited ‎04-08-2024 07:36 AM
Hi Dave,
I created this function for this same purpose , but haven't used it in some time.
gs.print(getDuplicates('<table Name>','<field name>'));
function getDuplicates(tablename,val)
{
var dupRecords = []; var gaDupCheck = new GlideAggregate(tablename);
gaDupCheck.addQuery('active','true');
gaDupCheck.addAggregate('COUNT',val);
gaDupCheck.addNotNullQuery(val);
gaDupCheck.groupBy(val);
gaDupCheck.addHaving('COUNT', '>', 1);
gaDupCheck.query();
while (gaDupCheck.next()) {
dupRecords.push(gaDupCheck[val].toString());
}
return dupRecords;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2024 03:05 AM
Hi,
Just checking to see if this is answered?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2024 04:15 AM
Hi @Community Alums check below link
If my answer help you please mark helpful and accept solution
Thanks and Regards
Harish
