2

On a brand new Drupal 7 / CiviCRM 5.6.0 install I created a custom field group for Grants and added one Contact Reference field and then created 2 grants. When I search for grants and export and try to export that Contact Reference field, the name of the Contact is limited to 16 characters.

Further testing indicates that the name of a Contact Reference field on a Contact record also is limited to 16 characters when exported.

4
  • Is it the same behaviour for contact or contribution or membership etc export? Commented Oct 10, 2018 at 17:37
  • This doesn't appear to happen with any other type of export. I just tried a contact record export with Display Name and it wasn't cut off. But then I tried with a Contact Reference on a Contact record and on export, the name of the referenced Contact is also cut off.
    – Hershel
    Commented Oct 12, 2018 at 12:13
  • So this is a core bug. Can you create a issue on git lab so that someone in the community can fix it? Also if possible try submitting PR for the fix if you can. Commented Oct 12, 2018 at 13:14
  • Thank you, issue created: lab.civicrm.org/dev/core/issues/439
    – Hershel
    Commented Oct 13, 2018 at 18:07

2 Answers 2

0

ContactReference custom field saves contact id, and that field has max 16 numbers.
But when CiviCRM prepares Contact to export, that contact id(max 16 numbers)
transforms to contact's display name(more than 16 chars).
When CiviCRM tries to insert(to temporary table) more than 16 chars to field(with max length 16 chars) then it slices that field.

This issue can be hot fixed in CiviCRM Core.
1. Find civicrm/CRM/Export/BAO/ExportProcessor.php file;
2. Find getSqlColumnDefinition method;
3. Replace varchar(16) to varchar(255).

CiviCRM Core need to add new condition: if is Custom Field with type ContactReference then use varchar(255) instead of varchar(16).

0

Here’s a PR that was closed and does not cleanly apply anymore but when applied manually I have a functional export for ESR 5.13.x

https://github.com/civicrm/civicrm-core/pull/12598

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.