VIP Group Automatic Priority of Medium

sseverance
Giga Contributor

Hi folks! We have a group of users we have assigned to a VIP group within Service Now. We would like to ensure that any time one of these users creates an Incident that the priority for that Incident is set to medium. We would like this to occur every single time automatically when the Incident is created. Can anyone provide information on how we can accomplish this? 

3 REPLIES 3

priyatam_pvp
Tera Guru

Create a before Insert Bussiness Rule with No conditions 

Below is the script:

(function executeRule(current, previous /*null when async*/) {
// Check if the caller belongs to the VIP group
var vipGroupID = 'YOUR_VIP_GROUP_SYS_ID'; // Replace with the actual Sys ID of your VIP group

var grGroupMember = new GlideRecord('sys_user_grmember');
grGroupMember.addQuery('group', vipGroupID);
grGroupMember.addQuery('user', current.caller_id);
grGroupMember.query();

if (grGroupMember.hasNext()) {
// If the caller is in the VIP group, set priority to Medium (3)
current.priority = 3; // Medium
}
})(current, previous);

Please mark it as Helpful

Regards
Priyatam

Rohit  Singh
Mega Sage

Hi @sseverance 

 

Please follow the below steps

 

1. Create On Submit Client Script get the value of Created By - g_form.getValue("sys_created_by") - It will give the sys_id of user who have created the incident. 

2. Use Glide Ajax in your on Submit Client Script and send the value of sys_created_by.

3. Create a client callable script include. Do a glide record in sys_user_grmember

var gr_user = new GlideRecord("sys_user_grmember");
gr_user.addQuery("user",this.getParameter("sysparm_sys_id"));     // Parameter sent from client script
gr_user.addQuery("group","c38f00f4530360100999ddeeff7b1298");   // sys id of Group
gr_user.query();
while(gr_user.next())
{
		return true;
}
	

4. In Client Script if answer == true then use g_form.setValue("impact",3) and g_form.setValue("urgency",3);

 

If my response helped, please mark it helpful and accept the solution so that it benefits future readers.

 

Regards,
Rohit

 

Chaitanya ILCR
Kilo Patron

Hi @sseverance ,

you can create a Before insert BR

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

    // Add your code here
    if (gs.getUser().isMemberOf('sys_id_of_the_vip_group' /*You group sysid(preffered) or name*/ )) {
        current.urgency = 1;
        current.impact = 3;
        //check the priority lookup table and impact and urgency combo which leads to Medium in you instance
    }

})(current, previous);

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya