Skip to content

Commit 098ad4e

Browse files
authored
Update script.js to work on inherited fields
1 parent a945dff commit 098ad4e

File tree

1 file changed

+5
-8
lines changed
  • Server-Side Components/Background Scripts/Duplicate Finder

1 file changed

+5
-8
lines changed

Server-Side Components/Background Scripts/Duplicate Finder/script.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Update ONLY below values to find duplicates
2-
var tableName = 'sys_user'; // ADD: Table you want for duplicates
3-
var fieldName = 'email'; // ADD: Field that you want to check for duplicates
2+
var tableName = 'incident'; // ADD: Table you want for duplicates
3+
var fieldName = 'short_description'; // ADD: Field that you want to check for duplicates
44

55
findDuplicates(tableName, fieldName);
66

@@ -17,12 +17,9 @@ function findDuplicates(tableName, fieldName) {
1717
}
1818

1919
// Check if field exists
20-
var fieldGr = new GlideRecord('sys_dictionary');
21-
fieldGr.addQuery('name', tableName);
22-
fieldGr.addQuery('element', fieldName);
23-
fieldGr.query();
24-
25-
if (!fieldGr.next()) {
20+
var gr = new GlideRecord(tableName);
21+
gr.initialize();
22+
if (!gr.isValidField(fieldName)) {
2623
gs.print('No field called "' + fieldName + '" on the "' + tableName + '" table.');
2724
return;
2825
}

0 commit comments

Comments
 (0)