Business Rule to limit who can assign a group to an incident

Lance_1
Tera Contributor

I have an ask to limit who can assign a specific group (group_a) to an incident, based on the users membership in select other groups (group_x, group_y, group_z).   I created a Business Rule that triggers when the Assignment group changes to group_a it runs the attached script.   The problem is that the script never finds the user when they are in fact a member of one of the selected groups.

1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

Hi @Lance_1 ,

Try this code in your "Before" business rule.

 

In When to Run tab, set the condition to:

Assignment Group :: Changes To :: group_a

 

Im your script use the following:

 

(function executeRule(current, previous){

   if(gs.getUser().isMemberOf(­'group_x') || gs.getUser().isMemberOf(­'group_y') || gs.getUser().isMemberOf(­'group_z')){

      //Do nothing 

   } else{

      gs.addErrorMessage('You are not allowed to assign to the selected assignment group');

      current.setAbortAction(true);

   }

 

})

 

 

Please mark my answer helpful, and accept as solution if it helped you to fix your issue ☺️

 

Thanks,
Anvesh

View solution in original post

1 REPLY 1

AnveshKumar M
Tera Sage
Tera Sage

Hi @Lance_1 ,

Try this code in your "Before" business rule.

 

In When to Run tab, set the condition to:

Assignment Group :: Changes To :: group_a

 

Im your script use the following:

 

(function executeRule(current, previous){

   if(gs.getUser().isMemberOf(­'group_x') || gs.getUser().isMemberOf(­'group_y') || gs.getUser().isMemberOf(­'group_z')){

      //Do nothing 

   } else{

      gs.addErrorMessage('You are not allowed to assign to the selected assignment group');

      current.setAbortAction(true);

   }

 

})

 

 

Please mark my answer helpful, and accept as solution if it helped you to fix your issue ☺️

 

Thanks,
Anvesh