Answers.Body: <p>CiviCase normally doesn't delete anything it just marks it deleted. You should be able to use advanced search and search for deleted contacts and restore the contact from there. Ditto Find Cases and check the box for deleted cases.</p>
  
  <p>But if the records were truly deleted then you also need:
  <code>
  civicrm_activity_contact
  civicrm_log
  and then there's a couple if you want the contact details too - civicrm_email, civicrm_address, civicrm_phone, civicrm_website (might be missing one or two)
  </code></p>
  
  <p>Also if you have custom fields the records in civicrm_value_XXX.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-10T08:21:53.447Z
Answers.Text: civicrm_log would mostly be for viewing edit histories or seeing the original creation time
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-11T07:29:02.783Z
Answers.Text: I do think an issue report might be good here, either the deleted case should be deleted when the contact is deleted or the user should be prevented from deleting the contact if there is still a case open?
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-09T16:50:38.447Z
Answers.Text: Unfortunately the contact was deleted permanently so I'm having to revert to backups.
Answers.UserDisplayName: Jon-man
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-09T16:52:04.927Z
Answers.Text: Strange that we need civicrm_log records too, but alas, they didn't get deleted. Still can't see the activities within the case (there are some in civicrm_activity and civicrm_case activity but they aren't showing)
Answers.UserDisplayName: Jon-man
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-09T16:17:12.643Z
Answers.LastActivityDate: 2015-11-09T16:17:12.643Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>Jon-man, can you check if the 'is_deleted' field in civicrm_case is set to 0, if the activities are still around in civicrm_case_activities and if the activities are still active?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-10T08:20:14.737Z
Answers.Text: Good point. And also for civicrm_activity for the latest revision of each activity check is_deleted = 0 and also is_current_revision = 1.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-09T16:53:58.510Z
Answers.LastActivityDate: 2015-11-09T16:53:58.510Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>If I've deleted a contact and it's related cases how can I restore the data from a backup?</p>
  
  <p>I've restored the records in civicrm_contact, civicrm_case, civicrm_case_contact, civicrm_activity, civicrm_case_activity and civicrm_case_activity_contact </p>
  
  <p>However, it still isn't showing the activities in the case. It shows the contact and case restored fine. But in the manage cases screen the activity listing is missing with the message 'No data available in table'.</p>
  
  <p>Any ideas?</p>
  
Tags: <civicase>
Title: In CiviCASE how do I restore a deleted case?
ThreadText: # In CiviCASE how do I restore a deleted case?
  
  (Asked by: username_0 on 2015-11-09)
  
  If I've deleted a contact and it's related cases how can I restore the data from a backup?
  
  I've restored the records in civicrm\_contact, civicrm\_case, civicrm\_case\_contact, civicrm\_activity, civicrm\_case\_activity and civicrm\_case\_activity\_contact
  
  However, it still isn't showing the activities in the case. It shows the contact and case restored fine. But in the manage cases screen the activity listing is missing with the message 'No data available in table'.
  
  Any ideas?
  
  **Tags:** civicase
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-11-09. Score: 2
  
  CiviCase normally doesn't delete anything it just marks it deleted. You should be able to use advanced search and search for deleted contacts and restore the contact from there. Ditto Find Cases and check the box for deleted cases.
  
  But if the records were truly deleted then you also need:
  `civicrm_activity_contact
  civicrm_log
  and then there's a couple if you want the contact details too - civicrm_email, civicrm_address, civicrm_phone, civicrm_website (might be missing one or two)`
  
  Also if you have custom fields the records in civicrm\_value\_XXX.
  
  > **Comments:**
  > **username_0**: Unfortunately the contact was deleted permanently so I'm having to revert to backups.  
  > **username_0**: Strange that we need civicrm_log records too, but alas, they didn't get deleted. Still can't see the activities within the case (there are some in civicrm_activity and civicrm_case activity but they aren't showing)  
  > **username_1**: civicrm_log would mostly be for viewing edit histories or seeing the original creation time  
  > **username_2**: I do think an issue report might be good here, either the deleted case should be deleted when the contact is deleted or the user should be prevented from deleting the contact if there is still a case open?  
  
  ---
  
  ### Answer by username_2 on 2015-11-09. Score: 1
  
  username_0, can you check if the 'is\_deleted' field in civicrm\_case is set to 0, if the activities are still around in civicrm\_case\_activities and if the activities are still active?
  
  > **Comments:**
  > **username_1**: Good point. And also for civicrm_activity for the latest revision of each activity check is_deleted = 0 and also is_current_revision = 1.  
  
  ---
  
  