Find duplicate user email (or anything else)
Just saw this gem on our internal Live Feed from our resident wizard Mr. Goodliffe. The question on Live was how can I easily locate users with duplicate email addresses. I've always used a GlideAggregate script running in background scripts which really limits it to admins and can't view the results in a list.Solution:Create a client callable script include to perform a query for duplicate records, then call that script from a list filter.
* Script Include:
/Client callable script include used for filtering sys_user liststo identify duplication email usersname: duplicateEmailactive: trueclient callabe: true/function duplicateEmail() { var xx = new GlideAggregate('sys_user'); xx.addAggregate('COUNT', 'email'); xx.addHaving('COUNT', 'email', '>', '1'); xx.query(); var answer = new Array(); while (xx.next()) { answer.push(xx.getValue('email')); } return answer;
}
* Call the script from a filter. Open the list of users, apply filter Email - is - javascript:duplicateEmail();* Run it and view the list of users that have duplicate email values
https://www.servicenow.com/community/in-other-news/find-duplicate-user-email-or-anything-else/ba-p/2268789