- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎06-19-2020 06:18 AM
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
Solved! Go to Solution.
- Labels:
 - 
						
							
		
			Incident Management
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎06-19-2020 07:37 AM
Hi,
write before insert business rule on incident table.
conditon:
Write below code :
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.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎06-19-2020 06:52 AM
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;
	}
}
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎06-19-2020 10:42 AM
Yes, I created a group (VIP), which includes all VIP members.
Thanks,
AJ
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎06-19-2020 07:10 AM
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 🙂
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎06-19-2020 10:42 AM
Yes, I created a group (VIP), which includes all VIP members.
Thanks,
AJ
