I am creating report to pull out Duplicate employee number from user table in Servicenow.
Asked
Active
Viewed 632 times
2 Answers
0
in a classless script include:
Use Glide Aggregate function groupBy employee number addaggregate count on employee number count > 1 return sys_id all the records
Report: put filter sys_id IN javascript:

c b
- 1
0
var dpchk = new GlideAggregate('sys_user');
dpchk.groupBy('employee_number');
dpchk.addHaving('COUNT', '>', 1);
dpchk.query();
while(dpchk.next())
{
gs.print('Therefore the duplicate employees number is'+dpchk.employee_number);
}
-
1Although this code might solve the problem, a good answer should also explain **what** the code does and **how** it helps. – BDL Apr 22 '20 at 11:19