Closing Cases

This page describes the ways to close cases in CommCare

Close Cases Manually

If you need to close a case that was opened erroneously and cannot or do not want to have the mobile user close the case, it is possible to manually close the case from CommCareHQ.

Locate the case by using the Case List report. At the bottom of the page, below all of the case properties is the Close Case button. After pushing the button you will see a message at the top of the screen confirming that the case was closed. Note that the closed-on date will populate.

In order to undo the closing of the case go to the Case History and select the most recent form (it will say "system" in the Form column). Click on the "Archive Form" button to re-open the case.

Closing cases through an Excel Import

The Excel importer also has the ability to close cases. To do this, add a column to your Excel file to specify which cases to the excel file to be mapped to the case and supply case or external id's for matching. In the following table, cases 1001 and 1002 will both be closed, but 1003 will not. Note that the close property needs to be added manually to your excel file.

case_id

close

case_id

close

1001

yes

1002

yes

1003

 

Prepare your Excel workbook for import.

  1. Go to 'Export Cases'

  2. Download "Open Cases" 

  3. This will give you access to the unique Case Id which will be random and look something like "2fa35b2d-e685-408f-99d5-17e215598fa1"

  4. Once you have identified the cases you would like to close, delete all columns except for the case id. 

  5. Add a "close" column, and complete each cell with the word 'yes'. 

  6. Save your file as a .xls or .xlsx

    Note: Please check that you have saved your workbook as a .xls or .xlsx file.

    Note: Prepare a separate excel file for each "case type" you would like to update. 

    Note: Closing cases on import only works when you are Updating Existing Cases.  It will not work when you are Creating New Cases.  If you want to open and close cases using import, you have to do it in three steps:  Create the new cases, Export the cases to get their case_id's, and then Update the cases with the "close" column as described below.


Specify the "case type" of the file you are importing.

 Next, map this column to the "close" property of a case. This isn't a real property, so use the "Create a new property instead" option to enter it.

Now, once you finish the import, all cases with a "yes" in the mapped column will be closed.

Note: To verify this import was successful, you can 'Export Cases' , select Open Cases, and review the Excel export to confirm that the cases no longer appear. 

Note: It is not currently possible to reopen a closed case using the Excel Importer. To do that you must use the Archive Forms tool to archive the form which closed the case. Closing a case using Excel Importer creates a submission for an "unknown" form in the case history, which can be archived to undo closing, i.e., reopening, the case.

To verify that your cases have been closed

Go to Reports > under the Inspect Data section > Case List. Run a report for the same case type you have uploaded. The report should show a Status column, and show closed for the relevant cases.