CiviCRM: How to get table info on a custom group (fieldset)

When you create a custom fieldset in CiviCRM, a new table is created, but the table name and field names are not altogether obvious. Here's a function that finds them out. All you need to know is the name you gave the fieldset (and the names you gave the fields).

So you might have created a field set to keep a record of contacts' favourite music called "songs". You may have given fields "Artist", "Title"...

Calling this function with "songs", you might find out, for example, that the table is called civicrm_value_songs_2 and that within that table, the artist field is called artist_5.

I wrote this code as part of a data migration/import project.

 

Tags: 

Add new comment