Name

sn_hr_er.er_SecurityUtilsAJAX

Description

No description available

Script

var er_SecurityUtilsAJAX = Class.create();
er_SecurityUtilsAJAX.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

  /* Needed to allow non-admin users to access this script include */
  isPublic: function() {
  	return true;
  },
  
  /* Used to determine if the current user can lock ER cases
   * @return Boolean   True if the current user can lock ER cases
   */
  canSeeLockedERCase: function() {
  	var userId = gs.getUserID();
  	var gr = new GlideRecord('sn_hr_er_case');
  	if (gr.canRead())
  		return new er_SecurityUtils().canSeeLockedCase(gr, userId);
  	else
  		return false;
  },
  
  /* Locks or unlocks an ER Case
   * @param  String  id   The id of the case to be locked
   * @param  Boolean lock True if should lock, false is should unlock
   * @return String       id of record if good update, null if update failed
   */
  setLock: function() {
  	var id = this.getParameter('sysparm_id');
  	var lock = this.getParameter('sysparm_lock');
  	var gr = new GlideRecordSecure('sn_hr_er_case');
  	if (gr.get(id)) {
  		gr.setValue('locked', lock);
  		return gr.update();
  	}
  	return null;
  },
  
  type: 'er_SecurityUtilsAJAX'
});

Sys ID

dd94957623770010fb0c949e27bf6531

Offical Documentation

Official Docs: