CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • custom fields with multiple records and profiles
Pages: [1]

Author Topic: custom fields with multiple records and profiles  (Read 809 times)

jere

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 1
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
custom fields with multiple records and profiles
September 24, 2012, 12:13:11 pm
I see that custom fields that have multiple records per individual do not show when trying to add fields to profiles. Is there a way to edit one row of multiple record custom fields in a profile by assigning them to the profile form through the civicrm_buildForm hook or by creating a custom copy of the Edit.tpl of Dynamic tpl for the profile?

I am new to this, though I am somewhat familiar with php.  If I use this same pattern of naming the form elements that is used in the standard custom field forms attached to contacts, is there a way to assign data to a profile form from one row of a multiple record custom field  in such a way that they will be picked up by the code that is creating the form (by using form->assign or something)? I notice that the standard forms for custom values use a custom_xx_yy pattern where xx is the id of the Customfield  and yy is the id of the row in the table created for the  custom data set. Is this correct?

If I cannot assign the fields such that they will be saved, can I include them as variables in the form and add the html and the data from the custom table manually to a custom copy of either the Edit or Dynamic.tpl files in a way that they will be saved by the existing code that processes profiles.

If the existing code cannot catch them to save them, can I do it in a hook and save them myself using an api or one of the DAO functions that are part of civicrm?

I am a bit over my head with this, so any help would be appreciated.

Jere

« Last Edit: September 24, 2012, 12:16:29 pm by jere »

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: custom fields with multiple records and profiles
September 24, 2012, 01:26:55 pm

you can do this, BUT it is a lot more involved and you will need fairly solid php / mysql / civi api skills to do so.

You can get started by reading the developer documentation here:

http://book.civicrm.org/developer/

I do the above on some of the pages in the school module. The code is publically available here:

http://svn.civicrm.org/sfschool/trunk/org.civicrm.school/

a brief blog post on this is here: http://civicrm.org/node/618

Note that there is a proposal to get a large part of this into 4.3. So hopefully this will happen (but 4.3 will not be out till nov at the very earliest)

http://issues.civicrm.org/jira/browse/CRM-10771

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

jere

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 1
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: custom fields with multiple records and profiles
September 24, 2012, 05:10:07 pm
Thank you so much for this. I will dig into the resources you linked to.

Jere

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • custom fields with multiple records and profiles

This forum was archived on 2017-11-26.