Answers.Body: <p>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</p>
  
  <p><a href="https://github.com/civicrm/civicrm-core/pull/12598" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/12598</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-29T17:12:56.830Z
Answers.LastActivityDate: 2019-11-29T17:12:56.830Z
Answers.UserDisplayName: KarinG - Semper IT
Answers.Body: <p><code>ContactReference</code> custom field saves <code>contact id</code>, and that field has max 16 numbers. <br>
  But when CiviCRM prepares Contact to export, that <code>contact id</code>(max 16 numbers)<br>
  transforms to contact's <code>display name</code>(more than 16 chars). <br>
  When CiviCRM tries to insert(to temporary table) more than 16 chars to field(with max length 16 chars)
  then it slices that field.</p>
  
  <p>This issue can be hot fixed in CiviCRM Core. <br>
  1. Find <code>civicrm/CRM/Export/BAO/ExportProcessor.php</code> file; <br>
  2. Find <code>getSqlColumnDefinition</code> method;<br>
  3. Replace <code>varchar(16)</code> to <code>varchar(255)</code>.<br></p>
  
  <p>CiviCRM Core need to add new condition: if is Custom Field with type <code>ContactReference</code> then use <code>varchar(255)</code> instead of  <code>varchar(16)</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-02T14:53:31.963Z
Answers.LastActivityDate: 2019-07-02T15:41:40.473Z
Answers.LastEditDate: 2019-07-02T15:41:40.473Z
Answers.UserDisplayName: Sirius
Body: <p>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.</p>
  
  <p>Further testing indicates that the name of a Contact Reference field on a Contact record also is limited to 16 characters when exported.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-10T17:37:21.530Z
Comments.Text: Is it the same behaviour for contact or contribution or membership etc export?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-12T12:13:51.460Z
Comments.Text: 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.
Comments.UserDisplayName: Hershel
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-12T13:14:55.070Z
Comments.Text: 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.
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-13T18:07:46.537Z
Comments.Text: Thank you, issue created: https://lab.civicrm.org/dev/core/issues/439
Comments.UserDisplayName: Hershel
Tags: <export><civigrant>
Title: Grant Export Custom field Cutoff
ThreadText: # Grant Export Custom field Cutoff
  
  (Asked by: username_0 on 2018-10-10)
  
  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.
  
  **Tags:** export, civigrant
  
  > **Comments:**
  > **username_1**: Is it the same behaviour for contact or contribution or membership etc export?  
  > **username_0**: 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.  
  > **username_1**: 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.  
  > **username_0**: Thank you, issue created: https://lab.civicrm.org/dev/core/issues/439  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-11-29. Score: 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>
  
  
  ---
  
  ### Answer by username_3 on 2019-07-02. Score: 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)`.
  
  
  ---
  
  