Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

based on Assignment group in incident ,related problem Assignment group must be auto populated

sasidhar3
Kilo Contributor

Hi,

Problems are to be assigned to the appropriate resolver groups based on the associated incident record ,

Based on Assignment group in incident ,related problem Assignment group must be auto populated means when we select an assignment group in incident , and when we relate any problem to that incident then the assignment group in problem must be auto populated as the same which we selected in incident .

How to do this could you please help me in this

Thanks in advance

1 ACCEPTED SOLUTION

Hi sasidhar,



Alternatively you can go with the below Business rule also. Let's take the scenario where the User updates the 'Problem' field available in the incident form manually without availing the UI Action 'Create Problem'. In that case the above script won't run and your requirement will not meet.


Hence I would encourage you to opt for the below Business rule which will be applicable for the above mentioned scenario as well as whenever the user clicks the UI Action 'Create Problem'.



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


  var prob =   new GlideRecord('problem');


  prob.addQuery('sys_id', current.problem_id);


  prob.query();


  if(prob.next()){


  prob.assignment_group = current.assignment_group;


  prob.update();


  }


})(current, previous);



find_real_file.png


find_real_file.png



I hope this helps. Please mark correct/helpful based on impact


View solution in original post

6 REPLIES 6

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Sasidhar,



Create an Before business rule(insert update checkbox set to true) on problem table with the filter condition as parent | is not empty and with script as


var gr = new GlideRecord('incident');


gr.addQuery('sys_id', current.parent);


gr.query();


if(gr.next())


{


current.assignment_group = gr.assignment_group;


}



You may also want to add another filter condition assignment group is not empty depending on your req.



P.S : This business rule is required in case you edit and add the problem manually on incident via slushbucket.



The same changes you will have to do on the UI action code. Adjust the code the same way by looking on how other fields are set on problem ticket.


amlanpal
Kilo Sage

Hi Sasidhar,



You only have to add 1 extra line of code in the OOB UI Action 'Create Problem', which is available in the Incident form. Please find the snapshot of the updated UI Action script below, where I have added line number 7 only.


find_real_file.png



I hope this helps. Please mark correct/helpful based on impact


Hi sasidhar,



Alternatively you can go with the below Business rule also. Let's take the scenario where the User updates the 'Problem' field available in the incident form manually without availing the UI Action 'Create Problem'. In that case the above script won't run and your requirement will not meet.


Hence I would encourage you to opt for the below Business rule which will be applicable for the above mentioned scenario as well as whenever the user clicks the UI Action 'Create Problem'.



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


  var prob =   new GlideRecord('problem');


  prob.addQuery('sys_id', current.problem_id);


  prob.query();


  if(prob.next()){


  prob.assignment_group = current.assignment_group;


  prob.update();


  }


})(current, previous);



find_real_file.png


find_real_file.png



I hope this helps. Please mark correct/helpful based on impact


i have tried your code but not worked



our action is when we select new button from related list of problem table-> incident->new



a new incident has to be created and assignment group and short description has to get from problem fields



kindly help for this


br1.JPG



br2.JPG