Posted 09.09.2009 by Jack
These are truly raw notes taken at the CiviCRM Developer Camp in NYC. These notes are mostly intended for and thus primarily decipherable by me, but I’m sharing them in case there’s something of use or interest for other folks.
Custom Fields & Profiles
- Custom fields come in sets; a given set of custom fields will be use to extend just one type of record (e.g. contacts, contributions, activities, events, etc), so you need to think carefully about where this information really belongs. You designate the record type that the custom data is used for at the set level, not at the individual field level, so choose carefully!
- Create and edit custom fields in Administer >> Customize >> Custom Data (v3.0 navigation structure, may not be the same in v2.x)
- Every new custom data set that you create becomes a new table in your system, named civicrm_value_your_custom_group_name_id_of_custom_group (example: civicrm_value_participant_info_16); every field you create in that custom group is a column in that table. There's also a foreign key column to the table of the record type that this custom data group is for.
- When creating a custom field, you choose the type of data for the field and the input field type. Additional options will appear depending on the type of data and input field type you select.
- Neat data type - Contact Reference, which provides an autocomplete list of the other contacts in your database.
- There's a hook that allows your custom field to look up options and values for a select field from an external data source.
- For Custom Data Groups created for Contacts (Contacts, Individuals, Organizations, or Households), there's a relatively new "Does this Custom Data Group allow multiple records?" option to record multiple instances of information for a custom data group. Example: a "Past Employment" custom data group with Organization, Job Title, and Employment Dates fields; you could record many past jobs for that contact, not just one.
- Current Limitations of Custom Data Groups: Can't export information in a custom data group with multiple records (though someone could probably right some custom SQL to do it, just can't do it through the CiviCRM export interface); you can't use custom data groups with multiple records in profiles.
- Create new profiles in Administer >> Customize >> CiviCRM Profile
- To include custom fields on, for example, an event registration form, you would add the custom field to a profile. When creating or editing the event registration form, you would tell it to embed that profile in the online registration form.
- You can also embed profiles in Drupal User Registration and View/Edit Drupal Users.
- Advanced Settings for profiles: limit listings to a specific group, add contacts to a group, notify when profile form is filled out, redirect URL for after profile form is submitted, cancel redirect URL for if someone cancels filling out the profile, use reCaptcha for the profile, Drupal account registration options, etc.
- Batch Update Via Profile - allows you to update records of a single type - do a search, select "Batch Update via profile" for the found set, then presented with a grid of editable fields from your selected profile for all of the contacts, including ability to propagate a value to all records in the found set.
- Can also use profiles for controlling what columns you see in advanced search; go to Settings for a Profile and select Use For > Search Results, then make sure that the individual fields in the profile are set to Public Pages or Public Pages & Listings visibility and have the "Results column?" box ticked.
- You can also invoke a search interface based on a profile by calling a profile url without "create" or anything else added to it (Fuzzy explanation, should probably look into this more)