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 to use data from another table in a custom data field multi select box
Pages: [1]

Author Topic: How to use data from another table in a custom data field multi select box  (Read 725 times)

slaterino

  • Guest
How to use data from another table in a custom data field multi select box
June 03, 2009, 03:20:36 pm
Hi,
I want to create a custom field in CiviCRM, but I would like for the user to be able to choose one of the Organisations listed within the database as one of the options. In some ways I guess this would be similar to the 'Employee of' field. I would also look to do this in other ways by using data from specific tables as the options in the multi select box of a custom data field. Does anyone know how I would go about doing this? Any help would be appreciated.

Thanks

Russ

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: How to use data from another table in a custom data field multi select box
June 03, 2009, 03:49:58 pm
You can do this by implementing the customFieldOptions hook (available as of 2.2.0):
http://issues.civicrm.org/jira/browse/CRM-4094

and populating the $options array with your Organisations, or other data values...

See here for general info on hooks in CiviCRM:
http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification

On a related note, you should be able to create a custom field which uses an "autocomplete" widget in 2.3 (http://issues.civicrm.org/jira/browse/CRM-4532). This will come in handy if you have LOTS of organizations / entries in the table you want to expose.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • How to use data from another table in a custom data field multi select box

This forum was archived on 2017-11-26.