If I need to delete a CiviCase Type or a CiviCase it can be confusing given that 'deleted' Cases are not actually removed from the db.

1 Answer 1


Civi Case Types cannot be deleted while there are Cases of that Type. Cases can be changed to a different Case Type which can then permit you to delete a Case Type with no Cases. But if you just want the Civi Cases gone then note that Civi Cases themselves, when 'deleted', remain in the system for audit purposes. To delete a Civi Case entirely it is necessary to do so either via the API Explorer (at /civicrm/api/explorer) or via sql.

Via API Explorer use CRM.api('case', 'delete', {'id' : xxx});

Via MySQL use

DELETE c, ca, a FROM 
civicrm_case c LEFT JOIN
civicrm_case_activity ca ON c.id = ca.case_id
LEFT JOIN civicrm_activity a ON ca.activity_id = c.id
WHERE case_id = xxx;

and this should take care of any case_contacts data and any rows in civicrm_relationships that have case_id

  • also need to deal with case_contacts and rows in civicrm_relationships that have case_id
    – petednz - fuzion
    Sep 14, 2017 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.