Skip to content

Commit 0504027

Browse files
authored
Update README.md
Updated the Readme file to reflect enhancement to the script. In addition, made it clear that there are 2 scripts (which was already the case). And per script explained the functionality in more detail. Including that of the original single script.
1 parent 1cbdd76 commit 0504027

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

  • Server-Side Components/Background Scripts/Find out Duplicate Records
Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1-
This script helps to find out duplicate records in the table and returns an array of the duplicate records sys_id's.
1+
# Duplicate Records Scripts Overview
22

3-
In this example I have shown how to find out records in knowledge table.
3+
# Duplicate Records.js
44

5-
All you need to do is use the call the function with the table and field values as shown below:
6-
DupCheck("kb_knowledge", "short_description");
7-
where "DupCheck" is the function, "kb_knowledge" is the table name and "short_description" is the field based on which your duplicates will be found.
5+
This script identifies duplicate values in a specific field of a fixed table (`incident`) and logs how many times each duplicate occurs.
6+
7+
- Uses `GlideAggregate` to count and group by the `number` field.
8+
- Logs each duplicate record directly to the console.
9+
- Limited to the `incident` table and `number` field.
10+
- No output array is returned; results are only printed.
11+
12+
---
13+
14+
# Duplicate Records for any table based on field.js
15+
16+
This script finds duplicate records in **any table** based on a specified field and returns an array of values from fields you choose.
17+
18+
- Uses `GlideAggregate` to detect duplicates and `GlideRecord` to retrieve full record details.
19+
- Function name: `findDuplicateRecords`
20+
- Accepts three parameters:
21+
- `tableName`: the table to search
22+
- `fieldName`: the field to check for duplicates
23+
- `outputFields`: an array of field names to include in the output
24+
- Logs each duplicate record as a structured JSON object.
25+
- Returns a readable array of objects containing the specified output fields.

0 commit comments

Comments
 (0)