Name

global.EscalationChecker

Description

No description available

Script

var EscalationChecker = Class.create();
EscalationChecker.prototype = {
  initialize: function() {
  },
  
  checkEscalationConflict: function(escalation) {
  	
     var lock_name = escalation.getValue("source_record");
     var lock = new global.GlideMutex(lock_name);
     lock.setSpinWait(1000);
     lock.setMaxSpins(5);
     var gr_source = new GlideRecord(escalation.getValue("source_table"));
     gr_source.get(lock_name);
  	
     if (!lock.get()) {	   
  	   return 1;  // time out
  	}
  	try {
  		if(!new sn_customerservice.EscalationUtils().canRequestEscalation(gr_source)) {
  			return 2;  // escalation has been created before
  		}		
  		return 0;  // can create new escalation
  	} finally {
  		lock.release();	
  	}
  },
  
  type: 'EscalationChecker'
};

Sys ID

c70fdad7b3100300ff6e6e5f26a8dcbb

Offical Documentation

Official Docs: