Skip to content

Instantly share code, notes, and snippets.

@amitrogye
Created April 17, 2020 04:24
Show Gist options
  • Save amitrogye/99f2b08e597a686f1fd9eec452b00eda to your computer and use it in GitHub Desktop.
Save amitrogye/99f2b08e597a686f1fd9eec452b00eda to your computer and use it in GitHub Desktop.
var formToAnalyze = '136ea52e4ffd0e00b794a88ca310c7e7';
var grf = new GlideRecord('sys_ui_form');
//grf.addQuery('view.name','AssetUser');
grf.addQuery('sys_id',formToAnalyze);
grf.query();
if(grf.next()){
gs.print('Table - ' + grf.name);
var grs = new GlideRecord('sys_ui_form_section');
grs.addQuery('sys_ui_form',grf.sys_id);
grs.query();
var arrfs = [];
while(grs.next()){
//gs.print(' --> ' + grs.sys_ui_section.getDisplayValue());
arrfs.push(grs.getValue('sys_ui_section'));
}
var q = new GlideAggregate('sys_ui_element');
q.addQuery('sys_ui_section','IN',arrfs);
q.addNullQuery('type');
q.addAggregate('COUNT', 'element');
q.addHaving('COUNT', 'element', '>', '1');
q.query();
var listOfDupes = new Array();
while (q.next()) {
gs.print('Field Name -- ' + q.getValue('element') + ' -- Duplicated '+ q.getAggregate("COUNT",'element') + ' times.');
gs.print('Present in following sections:')
var gruie = new GlideRecord('sys_ui_element');
gruie.addQuery('sys_ui_section','IN',arrfs);
gruie.addQuery('element',q.getValue('element'));
gruie.query();
while(gruie.next()){
gs.print(gruie.sys_ui_section + ' -- ' +gruie.sys_ui_section.caption);
}
gs.print('----------------------')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment