Change the assignment group to the group the fulfiller is a member of when changing the state of an incident to Resolved

heidiyablonski
Tera Contributor

Hello Community,

I have a request to change the assignment group to the assignment group of the fulfiller when they are changing the status of an incident to Resolved. What would be best way to accomplish this? I have a rule to change hte assigned to field to the person who is resolving the incident but I am struggling with what the  property would be for the assignment group a user belongs to.

 

This is my simple business rule  script for   changing the assed to person:

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

 // Add your code here
 current.assigned_to = gs.getUserID();

})(current, previous);

 

I dont want the UserID but I dont know what the property would be for the assignment group a user is a member of.

8 REPLIES 8

Venkateswarlu K
Mega Guru

Hi Heidi


As per your req you need to create a display Business rule and one client script. Display BR is to check whether user belongs to the group or not. You can pass the info from server to client with help of g_scratchpad


Now at client side based on this g_scratchpad value you can hide the related list.



Step 1: Create a display BR and place this group between function template in script box



var asgroup = current.assignment_group; //assuming portfolio is the column name and group is the column name on the referenced table  


var gr = new GlideRecord('sys_user_grmember');  


gr.addQuery('group', asgroup);  


gr.addQuery('user',   gs.getUserID());  


gr.query();  


if(gr.next())  


{  


g_scratchpad.user = 'true';  


}  


Step2: Create a OnLoad client script to hide related list.



function onLoad() {  


//Type appropriate comment here, and begin script below  


if (g_scratchpad.user) //do some action


{  


g_form.setReadonly('state',true);


alert('welcome group member ');


}  


}  


Try this i hope this will helpful to u


heidiyablonski
Tera Contributor

Thank you all for your feedback.


I ended up telling the customer that it wasn't feasible and communicated what many of you explained about the work that wouild need to be done -users with more than 1 group membership will need to have a preferred assignment group assigned - which would be a maintenance challenge as well as other implications that it would introduce.


Please mark your question answered then heidiyablonski


shivanipatel
ServiceNow Employee
ServiceNow Employee

Heidi,



We are glad you took advantage of the ServiceNow Community to learn more and to get your questions answered. The Customer Experience Team is working hard to ensure that the Community experience is most optimal for our customers.



If you feel that your question was answered, we would greatly appreciate if you could mark the appropriate thread as "Correct Answer". This allows other customers to learn from your thread and improves the ServiceNow Community experience.



If you are viewing this from the Community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thanks,


Shivani Patel


Unknown-1.png