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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • How can a custom field be defined to lookup possible values from a table?
Pages: [1]

Author Topic: How can a custom field be defined to lookup possible values from a table?  (Read 1340 times)

ailgm

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
  • Drupal solution provider
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.15
  • MySQL version: 5.0.89
  • PHP version: 5.2.9
How can a custom field be defined to lookup possible values from a table?
September 25, 2011, 12:59:10 pm
We'd like to have a custom field on the profile that is defined as a selection from a list in a table (where the table will have many more attributes per entry beyond name / value).  That table could be defined within CiviCRM (if there was a way) or in Drupal (6.x), since we have an integrated CiviCRM/Drupal database - either would be fine.

All I can find are:
A) Alphanumeric / Select field options, where the list of options must be typed in (we want to look them up).  In Drupal, the equivalent (that would do what we need) is a CCK text field with a Select list built by PHP code.
B) Contact References, which is a lookup/link to another contact (we want that sort of lookup but to a different table).  In Drupal, the equivalent is a CCK node reference field.

I can't see how to do this in CiviCRM, so
 1) If there is a way, could you please explain how we can? Is it possible to build a custom table in CiviCRM or should it be a Drupal table?  How can we define a lookup to be based on it?
or
 2) If there isn't a built-in way, could you provide some guidance on how to get started customizing CiviCRM's custom field types to add this?

Of course if anyone has done this, would you please share how you did it?

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: How can a custom field be defined to lookup possible values from a table?
September 25, 2011, 02:45:12 pm
There's a hook for this:
http://wiki.civicrm.org/confluence/display/CRMDOC40/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmcustomFieldOptions

ailgm

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
  • Drupal solution provider
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.15
  • MySQL version: 5.0.89
  • PHP version: 5.2.9
Re: How can a custom field be defined to lookup possible values from a table?
September 25, 2011, 08:24:00 pm
Thank you for the tip.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • How can a custom field be defined to lookup possible values from a table?

This forum was archived on 2017-11-26.