Name

global.AWACapacityUtils

Description

No description available

Script

var AWACapacityUtils = Class.create();
AWACapacityUtils.prototype = {
  initialize: function() {
  	this.roleUtils = new SNCRoleUtil();
  },

  getUsersInGroup: function(groupid) {
  	var gr = new GlideRecordSecure("sys_user_grmember");
  	var list = [];
  	gr.addQuery("group", groupid);
  	gr.query();
  	while (gr.next() && gr.canRead()) {
  		list.push(gr.getValue("user"));
  	}
  	return list;
  },

  getRoleList: function() {
  	return "aff2cdf293931300ed3ef5be867ffb76,2831a114c611228501d4ea6c309d626d,b05947ca0a0a0aa700fdef030c6bca07";
  },

  getUsersHasAWARoles: function() {
  	var gr = new GlideRecord("sys_user_has_role");
  	gr.addQuery("role", "IN", this.getRoleList());
  	gr.query();
  	var list = [];
  	while (gr.next()) {
  		list.push(gr.getValue("user"));
  	}
  	return new ArrayUtil().unique(list);
  },

  getGroupsWithAWAUsers: function() {
  	var gr = new GlideRecord("sys_user_grmember");
  	gr.addQuery("user", "IN", this.getUsersHasAWARoles());
  	gr.query();
  	var list = [];
  	while (gr.next()) {
  		list.push(gr.getValue("group"));
  	}
  	return list;
  },

  flushChannelWorkload: function(channelID, channelname) {
  	sn_awa.ServiceChannelUtils.flushWorkload(channelID);
  	gs.addInfoMessage(gs.getMessage("{0}: Capacity usage information for all agent on this channel has been reset and recalculated.", channelname));
  },

  recalculateWorkload: function(channelID, channelname) {
  	sn_awa.ServiceChannelUtils.recalculateWorkload(channelID);
  	gs.addInfoMessage(gs.getMessage("{0}: Capacity usage information for all agent on this channel has been reset and recalculated.", channelname));
  },

  type: 'AWACapacityUtils'
};

Sys ID

ee9c61d753531300afffddeeff7b1264

Offical Documentation

Official Docs: