Add-On

To enable this feature, you will need to enable an Add-On. To enable the add-on, proceed to the Application Settings by selecting the gear in the top left hand corner next to the application name. Then select the Add-On tab. Once on the Add-On tab, select the menu option on the right (three stacked lines) and check the Case Management box. Child cases will appear as an option in this section.


Overview

Child cases (also known as subcases) let you open other types of cases for use in other modules. They will be linked to the parent case so you will always know where they came from. The classic use case of a child case is a mother giving birth to a newborn that has to be tracked separately.

Child cases can be configured on the "case management" tab of any form that uses case management. Child cases can be opened from any question in a form including from a repeat group.

Example Use of Child Cases

Let’s assume you’re working with a Maternal Child Health (MCH) application in which you’re monitoring two different types of cases – pregnant/nursing mothers and children. Using child cases allows us to bypass having multiple registration forms for the different types of cases. For example, you can open a child case from a mother's birth form instead of having to fill out a separate child registration form.

  1. On CommCare HQ, go into your desired application. Click on the form in which you are registering your subcase/ related case.
  2. Select the “case management” tab. On the bottom of the case management tab, you will see the heading “Child Cases””. Select the plus (+) sign to open the secondary case you want that is linked to the “main” case. For example, if the child case were a baby, select the module in which the case type is "baby." 
  3. If desired, you can add a question that serves as the condition to open the child case (i.e. Only if the answer to <question> is <answer>). 
  4. Select the questions/data points that you want to also be associated to the child case. At a minimum you must specify a question that serves as the name of the new case.
  5. Save your changes and try it out!

 

Opening Child Cases from a Repeat Group

It is possible to open a child case from questions that are in a repeat group. This is useful if you want to be able to open multiple child cases of one type - for example if you want to be able to conduct a survey and register a case for every household member.

This is set up just like a standard child case block on the case management settings. However, keep in mind the following:

  • You will not be able to use the questions in the repeat group to update the parent case, only to update the child case. 
  • The "name" property must come from the repeat group, not from the parent case.
  • If you have multiple repeat groups that create cases in a single form, all properties saved to a single child case must be from the same repeat group. That is, you can't mix questions from different repeat groups when creating child cases.

Accessing Parent Case Properties

The application builder gives Child cases the ability to access and update properties of the parent case.

More concretely, this means you can update the parent case's properties from a child case's form, and load parent properties into a child's form. 

To reference a parent property, type:

parent/property_name

For example, on the case configuration tab for one of the forms in the child module, to refer to the Parent case property "dob", you would type

parent/dob

into the case property box.

Note that this only works one-way: the child can access/update its parent case's properties, but the parent case CANNOT access or update properties of its child cases.

Linking Parent and Child Case Data 

See the page Linking Parent and Child Case Data in the CommCare Data section.

2 Comments

  1. Anonymous

    Can I make more than one tier of subcases? In the health field this might mean child to mother to grandmother. In the agriculture sector, this means crop to plot to household.

    1. absolutely, you can have as many tiers as you like!