This script uses GlideAggregate to search a field on a table for duplicate values. It then returns the value with duplicates in an array.
var xx = new GlideAggregate('table');
xx.addAggregate('COUNT', 'field');
xx.addHaving('COUNT', 'field', '>', '1');
xx.query();
var answer = [];
This gist includes a script include and background script that can be used to export files from ServiceNow to a connected Midserver in many different formats. I took the code provided here and tweaked it so that I could do what I wanted to do.
- MidServer Script Include
var ExportToMidserver = Class.create();