CommCare – How to Automatically Close Child Case When Parent Case is Closed

commcare

Is is possible to automatically close the child cases associated with a parent case when the parent case closes?

Best Answer

It actually is possible to set up automatic child case closure based on the parent case closing, it just takes a few steps, and isn't exactly immediate:

1) when closing the parent case, set the case property close_case = 'yes'

2) go to the Data tab > automatically close cases, and set a new rule for the child case type with the filter parent/case_close = yes. You will have to specify the # of days after which the case should close if it hasn't been updated. Select the minimum (which I believe is 30). This means that when the parent case closes, the child case will close 30 days later.

3) to make sure these cases don't appear in your case lists, set the case list filter parent/close_case != 'yes' and/or close_case != 'yes' depending on the case type of the module.

It's a bit of a work around, but in the eye of the user, those cases will be gone as soon as the parent is closed, and on the back end, they'll be closed in 30 days.