1

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?

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.

  • Unfortunately the contact was deleted permanently so I'm having to revert to backups. – Jon-man Nov 9 '15 at 16:50
  • 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) – Jon-man Nov 9 '15 at 16:52
  • civicrm_log would mostly be for viewing edit histories or seeing the original creation time – Demerit Nov 10 '15 at 8:21
  • 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? – ErikH - CiviCooP Nov 11 '15 at 7:29
1

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?

  • Good point. And also for civicrm_activity for the latest revision of each activity check is_deleted = 0 and also is_current_revision = 1. – Demerit Nov 10 '15 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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