Child Case - How to Change Parent_ID (Assign to New Parent)

Hi all! I am trying to figure out the best way to change the parent ID for a child case, so that the child case is linked to a different parent case.

Is there a way to do this easily, without LookUp Tables or archiving and re-entering the whole child case form?

1 Like

I am also curious about this.

Hello all,

If you need to update many child cases at once, you can use the Case Import feature:

  1. Export the child cases from CommCareHQ (Include the case_id and parent_id columns).
  2. Update the parent_id column in the spreadsheet with the new parent case IDs.
  3. Re-import the spreadsheet to CommCareHQ to update the cases.

For more details, please take a look at our documentation here.

Best,
Shahid

Hi Shahid,

Thank you!

First question, is there another way to do it if we don't need to update multiple at once?

Second question, I'm running into a problem for how to delete duplicate cases. Specifically, a mobile worker has accidentally opened two household cases for one household. Let's say they opened Household A first, and Household B second. There are child cases (clinic appointments) under both household cases. For the child cases of Household B, I need to change their parent case to Household A. Then I need to delete Household B by archiving the form that created it. However, when I try this, I am not able to archive the form that created Household B because CommCareHQ says I need to archive all the forms that created Household B's former child cases first, even though they have been moved under a new parent case. I don't want to delete these child cases, as they are real clinic appointments, they were simply logged under the wrong household case. I know I could just "close" the incorrect household case, but I would rather delete it because we use "closed" cases to represent real households that stopped participating, rather than data entry errors. Is there a solution for this?

Thank you again!
Nina

Hi Nina,

Although the suggested method is recommend for multiple cases, you can most definitely use this option for single cases as well.

  • Export the child case, update the parent_id column in the spreadsheet with the new parent case ID, and re-upload the modified case data via the bulk case import tool.

Regarding your second query, this is how you can achieve this:

  1. Reassign Child Cases:
  • Update the parent case ID for each child case (clinic appointment) from Household B to Household A.
  1. Close Household B:
  • Since CommCare does not allow archiving a case while child cases exist, simply close Household B instead of deleting it. More information on this point can be found on our Data Management documentation.
  • This ensures that the case is no longer active but remains in the system for data accuracy.

Let me know if this helps.

Best,
Shahid