...
Code Block |
---|
var gr2 = new GlideRecord('sys_user_role'); gr2.addQuery('name','itil'); gr2.query(); if (gr2.next() ) { gs.print('itil group sysid is: ' + gr2.sys_id); } //var gr = new GlideAggregate('sys_user'); //GlideAggregate query var gr = new GlideRecord('sys_user'); gr.addQuery('roles','CONTAINS',gr2.sys_id); //gr.orderByAggregate('count'); //Count aggregate ordering //gr.groupBy('email'); //Group aggregate by the 'os' field gr.query(); var count = 0; while(gr.next()){ //Print the OS name and count of items with that OS // gs.print('Distinct operating system: ' + gr.os + ': ' + osCount); count++; } gs.print('count is: ' + count); var gr3gr4 = new GlideRecordGlideAggregate('sys_user_has_role'); gr3gr4.addQuery('role',gr2.sys_id); gr3gr4.groupBy('user'); gr4.query(); var count2 count3= 0; while ( gr3gr4.next() ) { count2++; } gs.print('aoeuaoeeaoeoa count: ' + count2); var gr4 = new GlideAggregate('sys_user_has_role'); gr4.addQuery('role',gr2.sys_id); gr4.groupBy('user'); gr4.query(); var count3=0; while (gr4.next()) { if (gr4.user.active!=false && gr4.user.email != '') { gs.print('one user record is: ' + gr4.user.email); count3++; } } gs.print('4p,p,.puixx.eu count: ' + count3); |
...