GlideAggregate function with passed-in parameters


var queryParam='email';
checkDuplUsers(true, queryParam);

function checkDuplUsers(activeUser, queryParam){
  var ga= new GlideAggregate('sys_user');
  ga.addAggregate('COUNT', queryParam);
  if (activeUser){
    ga.addActiveQuery();
  }
  ga.addHaving('COUNT', '>', 1);

  ga.query();
  gs.log("The following " + ga.getRowCount() + " users are duplicate on " + queryParam);
  while (ga.next()) {
      gs.log("GatherDuplicates " + queryParam + " " + ga.getAggregate('COUNT', queryParam) + " => " + ga.getElement(queryParam));
      
 }
}

Comments

Popular posts from this blog

Running transform maps asynchronously

Post a command to the ECC queue for the mid server to initiate a powershell file copy

GlideRecord setValue