The additional feature to choose whether or not to search primary details only (introduced somewhere in Civi 4.7) has an undesirable effect on case exports - with the preference set to 'no'.

As an example, if I run an advanced search for all ongoing cases of a certain type and try to export some of their information:

  • If you turn OFF search primary details only and export by case (not by contact) individual information like primary email or primary phone (provided the contact has more than one email/phone) it will export multiple rows per case. It ignores the fact that I asked it to export ONLY the primary email/phone etc and exports all the phone/emails the contact has.
  • Any other location chosen, 'home', 'other', etc is respected. Outputs one line, or if there is more than one home item, it exports additional lines but only for that location.
  • If I turn back ON the export works as you'd expect, one line per contact with the primary email/phone listed.
  • Exporting by contact has no issues with search primary details only turned off.

(Civi 5.5.3, Drupal 7.61, verified this behavior happens on the demo.)

While I know turning off search primary details 'fixes' the export issue. We were looking to use this feature to better search contacts with multiple phones/email. Can someone point me in a direction to what file might be controlling the case export

  • 2
    In some ways it sounds almost like it's working as designed, just maybe not intuitively. Yes you're telling it only export primary fields, but you've also (sort of) told the search subsystem to ignore what primary means by turning off the setting. This probably isn't specific to cases, so the "file" you're looking for is probably in CRM/Export or part of the search system, e.g. CRM/Contact/BAO/Query (as in the jira issue) or the api. It's the kind of thing I'd use xdebug and an IDE to trace, since it seems to bounce around a bit.
    – Demerit
    Commented Dec 27, 2018 at 19:53


Your Answer

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

Browse other questions tagged or ask your own question.