3

We've discovered what seems to be a bug creating large text fields from CiviCRM Custom Fields. I hope I'm able to explain this well enough.

Relevant environment information: - Drupal 7.59 - CiviCRM 5.1.0 and then 5.1.2 - PHP 5.5.9 (not recommended but supported) - Webform and Webform CiviCRM modules for Drupal enabled

And the steps we took: 1. Create custom fields of type text associated with a contact. Give it a very large database size, something like 6000. I haven't confirmed exactly at what point is too large, but 6000 definitely was.

  1. Create a webform on the Drupal side with CiviCRM processing enabled. Make contact 1 for CiviCRM processing able to show the large field and also accepting existing contacts. Edit the webform field for the existing contact so it is a dropdown select (just for easier testing).

  2. Fill out the form once to create a contact, filling in that field.

  3. Go back to the form and select the existing contact to be the one you created. The field does not auto-populate.

  4. Alternate way to test this is to go to the form with the parameter ?cid=[id] added to the URL, which will show errors on the screen about the field not existing.

==== After investigation, we discovered that the root of the problem seemed to be that the field was not being created in the database table for the custom value. For example, if the custom field group was called constituent and it was the 3rd custom group, the table I believe would be civicrm_value_constituent_3. Each custom field of that field group normally gets a column in this table, but if the large text size is too big, it doesn't create the column and it doesn't give any warnings either. Manually creating the columns into the table fixed the problem, reinforcing that conclusion.

It does still add to the civicrm_custom_field table, so no problem there. It's just the values table.

2

Did you create a large text field or a memo field? And if so did you inspect the logs?

If it is a text field. I assume that mysql has a limit on the column size so probably it is failing because of that error.

  • Text field, yes. Our tests would suggest the same: too big of a field is a problem. But as far as I can find, MySQL can handle text fields much larger than 6000, e.g. here stackoverflow.com/questions/6766781/… says 65,535. In any case, my suggestion and hope posting this would be CiviCRM to add a popup warning if you try to create a text field too large, rather than leaving us guessing why it didn't work even though it still shows up on the field list as if it did. – ryan_pw Jun 4 '18 at 12:27
  • I am not sure whether a popup with a warning will show up. However I do agree that would be helpful. – Jaap Jansma - CiviCooP Jun 5 '18 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.