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).
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. :-)