Skip to content

Conversation

@Shweyy123
Copy link

@Shweyy123 Shweyy123 commented Oct 6, 2025

README.md

📄 Duplicate Record Finder (ServiceNow Server-Side Script)

🧩 Description

This script helps identify duplicate records within any table and field in a ServiceNow instance. Using the GlideAggregate API, it performs a grouped query to find values that appear more than once, making it a useful utility for administrators and developers focused on data quality and integrity.

The script includes basic input validation and outputs a clean summary of the duplicated values along with their counts.


🚀 Features

  • ✅ Works on any table and field
  • ✅ Fast and efficient using GlideAggregate
  • ✅ Validates input parameters
  • ✅ Displays duplicates and counts
  • ✅ Designed to run as a Script Background or Fix Script
  • ✅ Read-only — it does not modify any records

🛠️ Usage

🔧 How to Run

  1. Go to System Definition > Scripts - Background
  2. Paste the script from script.js
  3. Replace the input variables:
    var tableName = 'incident'; // Change this
    var fieldName = 'caller_id'; // Change this
  4. Click Run Script

🖥️ Example Output

Duplicate values found in table: incident, field: caller_id
Value: 46d44f3adb2c2300b6a6f1f3ca9619bb | Count: 4
Value: 5c8b8d3adb2c2300b6a6f1f3ca9619cc | Count: 3

📁 File Structure

Server-Side Components/
└── Duplicate Record Finder/
├── script.js
└── README.md

📋 Prerequisites

  1. A valid ServiceNow instance
  2. Script must be executed by a user with admin or script execution permissions
  3. Valid table name and field name (case-sensitive)

⚠️ Notes

  1. The script outputs sys_id values for reference fields. You can customize it to resolve display values if needed.
  2. Ideal for use in development or test environments first.
  3. Can be extended to flag or clean duplicates if required.

✅ Pull Request Checklist Compliance

✔️ Descriptive title and purpose
✔️ README.md with detailed usage and output
✔️ Categorized under Server-Side Components/
✔️ No XML exports or sensitive information
✔️ Tested in a ServiceNow environment
✔️ Relevant to ServiceNow developers

👨‍💻 Author

Contributor: @Shweyy123
PR Reference: #1846
Script: script.js – Duplicate Record Finder

@Atul-LNG Atul-LNG self-assigned this Oct 6, 2025
@ravichandra1998g ravichandra1998g assigned rohi-v and Atul-LNG and unassigned Atul-LNG and rohi-v Oct 6, 2025
Copy link
Contributor

@Atul-LNG Atul-LNG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Shweyy123
As per the guidelines, please add a README file as well. It should provide more details about the use case and the code you’ve written.

Once completed, kindly post the updated and well-documented version for review.

@Shweyy123
Copy link
Author

Hi @Atul-LNG ...
The description i have provided is the readme file.. Whether it is wrong

@Atul-LNG
Copy link
Contributor

Atul-LNG commented Oct 6, 2025

Hi @Shweyy123
Appreciate your response. However, a README file is required for the code snippet. The description alone is not a replacement for the README.

Please copy the content from the description into a proper README file. If any changes are needed, make those as well, and then resubmit.

@Shweyy123
Copy link
Author

Hi @Atul-LNG ..
I have attached the readme file .. Could u pls check

@Atul-LNG
Copy link
Contributor

Atul-LNG commented Oct 6, 2025

Hi @Shweyy123

It seems there’s some confusion. I didn’t ask you to attach the file separately — you need to check that the README file is included along with the JS file in your submission. It should show here.

image

@Atul-LNG Atul-LNG requested a review from rohi-v October 6, 2025 12:24
Copy link
Contributor

@rohi-v rohi-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shweyy123 I can see that you have just changed the variable name inside the script and added extra comments.

It appears that this contribution is a duplicate or resembles spam, potentially aiming to game the Hacktoberfest event. As a reminder, submissions marked as spam may lead to account restrictions or disqualifications. Please ensure to make unique and meaningful contributions, and refrain from spamming or duplicating submissions. Closing this as spam.

@rohi-v rohi-v added the spam label Oct 6, 2025
@Atul-LNG Atul-LNG closed this Oct 6, 2025
@Shweyy123
Copy link
Author

Hi @Atul-LNG ..
I think I have done a mistake .. Sorry for the confusion
Let me correct this

@Swetha-dev59 Swetha-dev59 mentioned this pull request Oct 7, 2025
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants