Published
Tuesday, February 3, 2009 - 19:23
Written by
Do you wish you could configure custom fields to store Employment History, Educational Background, Volunteer Skills or other types of information where you may need to enter multiple sets of values for a contact? Starting with CiviCRM 2.2, you can do just that. For example, if you need to collect Employment History - you might have fields for Job Title, Start Date, End Date, and Reason for Leaving. Enabling the "multiple records" setting in that custom data group will allow you to enter that information for multiple jobs. You can also set the maximum number of records which can be recorded per contact (you might only want data for the three most recent jobs).
 

How do I set up a multiple-record custom data group?

  • Go to Administer CiviCRM » Customize » Custom Data
  • Click "New Group of Custom Fields"
  • Select Contacts, Individuals, Households or Organizations for "Used For" record type.
  • Check the box for "Does this Custom Data Group allow multiple records?" and select Tab as the "Display Style".
  • If you want to limit the number of records per contact, enter a number for "Does this Custom Data Group allow multiple records?"
  • Complete other form fields as needed and click "Save"
  • Add one or more custom fields to your group.
That's it. When you view a contact and click on the tab for your new custom data group - you will find a link within the Edit form allowing you to create multiple records. The team is still working on the functionality needed to DELETE any specific instance of a set of values. This should be ready by beta 2. But the rest of the feature set is part of beta 1 and ready for you to try out. Post any questions, feedback and examples of your use cases for this in the 2.2 Release Testing forum board. Extra karma points to anyone who can find and post a reproducible bug in this feature (and super karma if you also include a patch to fix it).
 

Any gotchas?

There are definitely some restrictions and limitations in the 2.2 implementation:
  • It is restricted to custom data used for Contacts (including individuals, organizations and households). You can't use it for other record types (e.g. contributions, memberships ....).
  • You have to use the Tab display style (i.e. Inline display is not supported).
  • You can't import or export custom fields that use the multiple records feature.
  • You can't use custom fields in Profiles when they're configured for multiple records.
We hope to address most or all of these limitations in 2.3+.
 

Under the covers...

For you semi-geeky readers (a moniker I proudly wear), the database implementation of this feature is pretty simple. Starting with 2.0, custom field values have been stored in separate tables by custom data group. Using our Employment History example again, if you had created a custom data group with those 4 fields - the values would be stored in a civicrm_value_employment_history table with a column for each field and an entity_id column which is the foreign key to the contact record for that row. As planned, this feature leverages the new schema - any number of additional rows linked to the same contact ID can be inserted in the "value" tables. :-)
Filed under

Comments

I'm going to use civi to smoothe the recuitement process, and was going to use a profile to let the candidate fill a form instead of spamming a poor mail box.

X+

when we restructure and merge profiles and custom groups a bit more, we'll add this feature :)

lobo

Use CiviCRM? Like CiviCRM? Then show your appreciation and donate to CiviCRM

Kinda of a 'gotcha' for a client who would use this right now. Would a contribution of time assist?

That's what I've been waiting for :).
Is it going to be possible to take existing custom data and implement this retroactively?

since this does not involve data loss :) but you cannot convert from multi->single (in 2.2)

lobo

Use CiviCRM? Like CiviCRM? Then show your appreciation and donate to CiviCRM

You can't import or export custom fields that use the multiple records feature.
Is the data retrievable/savable via the API then? --
Dave Hansen-Lange
Web Developer
Advomatic LLC
http://advomatic.com
Hong Kong office

but a code contribution to do so would be nice and gratefully accepted :)

lobo

Use CiviCRM? Like CiviCRM? Then show your appreciation and donate to CiviCRM

I've noticed that multiple-record custom data groups are not available in views.  I found a fix but I'm unsure of the consequences.  See http://forum.civicrm.org/index.php/topic,17658.msg80183.html#msg80183

 

Is this fix viable and/or is there a plan to get multipl-record custom data groups to show up in views?

 

There was hope expressed of addressing the limitations in release 2.3 or later.

Has any work been done yet on allowing multi-record custom fields on Activities?

As a separate question, has any thought been given to a design where some fields may be singular and others grouped (multiple) - for instance using a hierarchy for their definition (much as say, Drupal menu items may be top-level or indented under another item), and a grid-like UI for the data entry / display?

Has any work been done yet on allowing multi-record custom fields on Activities? Three years later so this may have been addressed somewhere else but i cam across this thread searching for the ability to add multirecord fields to an activity...