Child case closed once parent case is closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-22-2022 03:45 AM
Hi All/
Once parent case is closed complete child case also be complete.
Parent case is (sn_hr_core_case_global_mobility) and child 2 cases are the table (sn_hr_core_benefits).
both tables have parent and child relation ship. Once we complete parent case the child case is closed complete.
but in our cases child cases are cancelled. why it is happening ??
that's why i tried BR once parent case closed complete child case should be complete. Any error these BR ??
before update. it is not working.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var closedChild = 0;
var grCase = new GlideRecord('sn_hr_core_case_global_mobility');
grCase.addQuery('parent_sn_hr_core_case_global_mobility', current.sys_id);
grCase.query();
var totalChildCount = grCase.getRowCount();
gs.addInfoMessage("CNT: " + totalChildCount);
while (grCase.next()) {
if (grCase.state == 18) {
closedChild += 1;
}
}
if (closedChild != totalChildCount) {
gs.addErrorMessage("please close All child cases");
current.setAbortAction(true);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-22-2022 04:34 AM
Hi,
Did you check any other BR is setting the state as cancelled?
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader