The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Parent RITM should be closed only when all Child RITMS close completed

naveen14
Kilo Guru

Hi All,

we was creating one Parent RITM with few records data once the RITM is approved automatically it will create different child RITM's based on the records selected in parent RITM.

only when all the child RITM's gets close completed the parent RITM should closed completed.

I was using WAIT FOR CONDITION in Workflow but its not waiting till all child to complete.

 

Thanks,

Naveen.

 

6 REPLIES 6

Abhijit4
Mega Sage

Hi Naveen,

You may try with BR with below configuration,

BR configuration:

Table="sc_req_item"

Condition : State changes to closed complete

Script: 

Write a script to check if all child of current parent record are closed and close RITM accordingly.

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Thanks and Regards,
Abhijit
Community Rising Star 2022

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Hi Abhijit,

 

BR will have performance issue so max we need to use Workflow only.

 

Thanks,

Naveen

 

Yes, right. Please share what you have written in wait for condition so that we can help you further.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP


Hi Abhijit,

 

var parentritm = current.sys_id;

var request = new GlideRecord('sc_req_item');
request.addQuery('parent', parentritm);
request.addQuery('active', 'false');
request.query();
var count = request.getRowCount();
if (count == 0) {
    answer = true;
}

Thanks,
Naveen