close child incident state after parent

Ravi Borade
Giga Contributor

I want to set child incidents state to close after parent state is closed by using business rule 

here is my approach tell me where I'm wrong

find_real_file.png

find_real_file.png

 

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

Hello @Ravi Borade ,

PLEASE replace your script like below.

Child incidents are stored on parent field so you need to glide record with parent field

And also change your condition from state is closed to  stage changes to closed

var gr= new GlideRecord('incident');
gr.addQuery('parent',current.sys_id);
gr.query();
while(gr.next())
{
gr.state=7;
gr.update()
}

Please mark my answer correct if it helps you

 

View solution in original post

13 REPLIES 13

@ravi borade Yep, what's it ?

your code works fine but a slight change in a different field is giving output as well ... I've changed parent to child_incident it is giving output but it hangs the instance for 8 mins and then give right output

Not working...?

 

Can u please help me...

Yousaf
Giga Sage

Hi Ravi,

Check this: 
https://community.servicenow.com/community?id=community_question&sys_id=9f5d6107db758550e2adc2230596...

 

Mark Correct or Helpful if it helps.


***Mark Correct or Helpful if it helps.***