3

Have just discovered ( and confirmed on https://wpmaster.demo.civicrm.org ) that Relationships of a deleted Contact are continue to be active and are displayed as such.

Not quite sure if it is a bug or a feature? Why would Relationships with deleted Contacts be kept active? Shouldn't the system at least disable them?

enter image description here

2 Answers 2

2

Interesting question ... if they were disabled, it would make restoring the contacts a bit more complicated since it would need to figure out which relationships to re-enable. But disabling certainly seems reasonable.

As a workaround, you could write custom code using hook_civicrm_post to disable them, or probably do something with CiviRules.

It's probably worth creating an issue to get wider discussion.

2
  • Yep we have hit this when building Views and SearchKits so have to remember to specify 'contact is deleted = NO'
    – petednz - fuzion
    Commented Dec 20, 2023 at 17:53
  • I use hook_civicrm_postCommit for altering one of Individuals custom field value. Since Individuals can have multiple Organization relationships, each time an Organization is deleted we check if there are any active Relationship left and change the field value if there are none. And this is where things get complicated: the Organization is deleted but the Relationship stays active. I think the simultaneous Relationship disable would be an answer here.
    – yurg
    Commented Dec 21, 2023 at 9:04
4

It looks like that changed when the contact summary "Relationships" tab was replaced with a SearchKit version.

I've submitted this PR to fix it and hide deleted contacts from that tab.

4
  • Thank you, this will make things less confusing. Why "hide" and not move under the "Inactive"?
    – yurg
    Commented Dec 21, 2023 at 9:13
  • 2
    Because the contacts do not exist except in the trash, so they should not be shown anywhere in the UI.
    – Coleman
    Commented Dec 21, 2023 at 17:20
  • 1
    We have noticed the same issue and are puzzled. Maybe if Relationships are hidden because the contact went into Trash, there should be some way of identifying it, so if the contact is recovered, the relationships can be restored to their prior state. Commented Dec 26, 2023 at 16:08
  • You ought to be able to still view the deleted contact and click on their Relationships tab and see their relationships.
    – Coleman
    Commented Dec 26, 2023 at 23:11

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.