0

Title kind of says it. I found some Cases with no Case Contact in the db. Tried Find Case and Case Reports etc but not sure I can see a way, even when knowing the Case ID, that I can find the problem Case (and hopefully also 'fix' it)

I know I can probably resolve this in the db, but ideally I shouldn't have to.

If i know the Case ID then perhaps API Explorer will let me assign a new Case Contact. But first I need to be able to tell there are some problem Cases.

1 Answer 1

1

select c.id from civicrm_case c left join civicrm_case_contact cc on cc.case_id = c.id where cc.contact_id is null

then

insert into civicrm_case_contact (case_id, contact_id) values (1,2)

where 1 and 2 are the real numbers


OR it is possible with search kit:

enter image description here

4
  • indeed. that is where I was heading but in the interest of the wider group of civicrm users I was wanting to confirm if there was a UI approach, and if not, and if there should be, then we might take a look at what changes would be needed to make this viable.
    – petednz - fuzion
    Commented Apr 11, 2022 at 19:05
  • You might be able to do it with search kit, but this situation shouldn't happen, so I'd be more interested in figuring out why the foreign keys allow it and what to do about that.
    – Demerit
    Commented Apr 11, 2022 at 19:19
  • it is possible these were created in webform hence the 'how can it be created with no case contact' may not be a pure civi question
    – petednz - fuzion
    Commented Apr 12, 2022 at 5:03
  • Or maybe "permanently deleted" contacts creating orphan cases, but if so, then that seems an issue with foreign keys in the database.
    – Demerit
    Commented Apr 13, 2022 at 3:47

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.