How to identify a duplicate record by multiple fields in ServiceNow - ServiceNow Developer Pro-Tips

PHOTO EMBED

Tue Jun 18 2024 23:15:03 GMT+0000 (Coordinated Universal Time)

Saved by @RahmanM

var dupeRecords;
dupeRecords = getMultiFieldDupes(
    'incident', //Table name
    ['short_description', 'assignment_group', 'assigned_to'], //Fields to check for duplicates
    ['short_description','assigned_to'], //Fields that must not be blank
    true //Get the sys_ids of the records with duplicates
);
//Print out the results:
gs.info(
    'Found ' + dupeRecords.length + ' duplicate types:\n' +
    JSON.stringify(dupeRecords, null, 2)
);
content_copyCOPY

https://snprotips.com/blog/2024/how-to-identify-a-duplicate-record-by-multiple-fields-in-servicenow