Assignment Rule scripting for assigning incident if requester is part of perticuler group

K_Sankalp
Tera Contributor

Hello,

We have create assignment rule for incidents, if the incident creator is part of particular group then the incident should assign to particular assignment group.

I can create it for particular field on the incident form but not able to check that requester is part of particular group.
we have to create it for 5 to 6 groups.

1 ACCEPTED SOLUTION

Sagar Pagar
Tera Patron

Hi @K_Sankalp,

 

You can try this sample scripts and modify it accordingly.

 

var userRecord = gs.getUser().getUserByID(current.creater_field_name);

if(userObject.isMemberOf('group_sys_id1') || userObject.isMemberOf('group_sys_id2') || userObject.isMemberOf('group_sys_id3'))
current.assignment_group = assignment_group11_sys_id;

}
else{
current.assignment_group = assignment_group22_sys_id;
}

 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow

View solution in original post

1 REPLY 1

Sagar Pagar
Tera Patron

Hi @K_Sankalp,

 

You can try this sample scripts and modify it accordingly.

 

var userRecord = gs.getUser().getUserByID(current.creater_field_name);

if(userObject.isMemberOf('group_sys_id1') || userObject.isMemberOf('group_sys_id2') || userObject.isMemberOf('group_sys_id3'))
current.assignment_group = assignment_group11_sys_id;

}
else{
current.assignment_group = assignment_group22_sys_id;
}

 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow