How to add a Business Rule Condition for Is Parent Incident (or not)?

apjohn2
Mega Sage

We use Parent Incident / Incident relationships (Istanbul).

I'm working on a Business Rule that will reopen an Incident if the customer (caller_id) adds a comment in the UI (not a baseline functionality).

However if the current incident is the parent of one or more other Incidents, the BR should NOT fire. I'm having a hard time with adding the condition and am looking for some help.

In other words the BR needs to check if the current Incident has one or more child incidents associated with it (not the other way round).

If I have to, I'm willing to add a Boolean field to the Incident table and update it to 'true' at the moment it is added as the 'Parent Incident' in a child incident is added (and 'false' when removed) but I'd rather avoid that if possible.

Any help is appreciated. Thank you!

1 ACCEPTED SOLUTION

apjohn2
Mega Sage

Of course as soon as I posted this I found it.



There's a counter on the Incident table called 'child_incidents'. I've confirmed this keeps track properly as child incidents are added and removed.



So the condition I'm looking for is 'Child incidents' | 'is' | '0'.



Yay!


View solution in original post

3 REPLIES 3

apjohn2
Mega Sage

Of course as soon as I posted this I found it.



There's a counter on the Incident table called 'child_incidents'. I've confirmed this keeps track properly as child incidents are added and removed.



So the condition I'm looking for is 'Child incidents' | 'is' | '0'.



Yay!


Mike Allen
Mega Sage

In scripting, you would do a basic script:



var inc = new GlideAggregate('incident');


inc.addAggregate('COUNT');


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


var inc_count = 0;


inc.query();


if(!inc.next()){


        // do your stuff here


}


Man that's a beautiful alternative and what I'd have used for certain had I not found the child_incidents attribute. Thank you Mike!