Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to Automatically set the Priority and Urgency = High for VIP Group Incidents

TStark
Kilo Sage

I would like to create a script to include in an Inbound Action that will set the Priority and Urgency to High if the incident is created by a user/member of the VIP Group.

Thanks in advance,
AJ

1 ACCEPTED SOLUTION

Harish Vaibhare
Kilo Guru

Hi,

write before insert business rule on incident table.

conditon: 

find_real_file.png

Write below code :

find_real_file.png

code: 

(function executeRule(current, previous /*null when async*/ ) {

// Add your code here

var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", current.caller_id);
gr.addQuery("vip", true);
gr.query();

if (gr.next()) {

current.impact = "1";
current.urgency = "1";
current.priority = "1";

}

})(current, previous);

 

Kindly mark helpful and correct if it works.

Thanks.

View solution in original post

7 REPLIES 7

Kieran Anson
Kilo Patron

Hi AJ,

Are your VIPs in a specific group or are you just referencing the user record and checking whether the VIP boolean value is true?

var userRecord = new GlideRecord('sys_user');
if (userRecord.get('sys_id',email.from_sys_id)){
	userRecord.vip == true ? setPriority('high') : setPriority('low');
}

function setPriority(type){
	switch(type){
	case 'high':
		current.priority = 1;
			break;
	
	
	case 'low':
		current.priority = 4;
			break;
	}
}

Yes, I created a group (VIP), which includes all VIP members.

Thanks,
AJ

sharayukasar
Mega Expert

Hi AJ ,

You can call script include from inbound action as below :

var emailutil = new ScriptInclude_Name();//mention a script include name here

var vip=emailutil().setcritical(email.origemail); // here lets pass sender as function  parameter.

if(vip==true){

current.urgency=1;

current.priority=1;

}

A script include function will something like below :

setcritical:function(sender){

var isVip=false;

var gr_user=new GlideRecord('sys_user');

gr_user.addQuery('email',sender);

gr_user.query();

if(gr_user.next() && gr_user.vip==true){

isVip=true;

}

return isVip;

},

Similarly you can add script in the same function in script include for checking if user is group member of a VIP group.Please note Script is not tested.

Kindly mark helpful/correct if my answer helps you 🙂

Yes, I created a group (VIP), which includes all VIP members.

Thanks,
AJ