Incident Assigned to field and Assignment group dependency

Jet R
Tera Contributor

I have a requirement in incident that if:

1. If the Assigned to is populated, and the Assignment group field is empty, the Assigned to field should not also be empty. Currently, OOB functionality the assigned to field is getting empty once the assignment group is empty. 

2. If the Assigned to field is populated and the Assignment group changes, the assigned to field will be empty only if the user is not a member of that new assignment group. 

 

Can someone please help me how to achieve this? 

6 REPLIES 6

JoeSD
Tera Expert

Hi Jet R,

 

1. I found that there is a client script for the Incident table called "Empty assigned_to on group change" that I was able to deactivate and get your desired result.

2. I created a business rule with the following script to clear the assigned to field only if the user is not part of the new assignment group: 

(function executeRule(current, previous /*null when async*/) {
 
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group',current.assignment_group.sys_id);
gr.addQuery('user',current.assigned_to.sys_id);
gr.query();
if (!gr.hasNext()) {
current.assigned_to = '';
})(current, previous);
 
Thank you,
Joe

Jet R
Tera Contributor

Hi @JoeSD 

May I know why you created a BR? And what type of BR is this? Thanks

Hi @Jet R 

This BR on the incident table is to clear the "Assigned to" field if a if the user in that field is not part of the the new "Assignment group". I used the following "When to run" settings: 

JoeSD_0-1693486568860.png

 

Thank you,

Joe

 

GTSNOW
Giga Guru

I think this is how it is working OOB as well.

 

I selected the Bow Ruggeri in assigned to and network group in assignment group.

Bow Ruggeri is part of Network and Hardware group.

GTSNOW_0-1693424247897.png

 

When I changed the group to Hardware. Assigned to did not become empty and still had Bow as he is part of the new changed group as well.

GTSNOW_1-1693424376834.png

 

When I changed to a totally new group then it updated assigned to as empty.

GTSNOW_2-1693424404942.png

 

If you found my response helpful or relevant to your query, please consider clicking the "Helpful" button or giving it a "Like". This not only helps others identify useful replies but also encourages contributors like me to continue assisting the community. Thank you for your support!