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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Getting custom data - is there a function that does this?
Pages: [1]

Author Topic: Getting custom data - is there a function that does this?  (Read 925 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Getting custom data - is there a function that does this?
March 22, 2009, 12:38:24 am
Looking at the sample module and the various functions I couldn't figure out a function that would retrieve the data out of custom data fields but there must be something I'm missing!

The best way I could come up with to return all the values in the (only) (multiple) customField belonging to customGroup 18 was this.


  $tableName = CRM_Core_DAO::getFieldValue( 'CRM_Core_DAO_CustomGroup',  18,'table_name' );
  $fieldName = CRM_Core_DAO::getFieldValue( 'CRM_Core_DAO_CustomField',  18,'column_name','custom_group_id' );
   
    $sql = "
SELECT *
FROM $tableName
WHERE  entity_id = $fields[current_employer]
"; 
   

  $dao = CRM_Core_DAO::executeQuery( $sql,CRM_Core_DAO::$_nullArray );
     while ( $dao->fetch( ) ) {
                $emaildomains[] = $dao->$fieldName;
            } 
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

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: Getting custom data - is there a function that does this?
March 22, 2009, 07:10:55 am

CRM/Core/BAO/CustomValueTable.php, function getEntityValues

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Getting custom data - is there a function that does this?

This forum was archived on 2017-11-26.