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) »
  • how to retrieve a custom table field value?
Pages: [1]

Author Topic: how to retrieve a custom table field value?  (Read 2373 times)

saffrongeek

  • Guest
how to retrieve a custom table field value?
June 17, 2009, 04:16:04 am
Hi,

     I am a newbie with civicrm and drupal integration and customisation. I have used the CRM_Core_DAO::getFieldValue(..) to get a field value for dao object. But I do not find, how to get a field value from a custom temporary table with searched value column.

    It would be a great pointer since I have to write a cron script which used few temporary tables to prepare params for creation to civicrm events table.

   Thanking in advance, I remain

Regards,

Harish Balakrishnan Marar

abrookins

  • I’m new here
  • *
  • Posts: 21
  • Karma: 5
    • Redspire (Blog)
Re: how to retrieve a custom table field value?
June 17, 2009, 07:41:04 am
One way is to use something like the first two code snippets xurizaemon included in this post:  http://forum.civicrm.org/index.php/topic,3695.html

He adds a static method -- CRM_Core_BAO_CustomField::getCustomFieldID() -- which returns the ID of the custom field, and then uses it as a parameter in his civicrm_contact_get() call.

However, I'm interested in the best way to do this as of 2.2.5. 

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: how to retrieve a custom table field value?
June 17, 2009, 08:50:31 am

Thats is still a good way to do it for 2.2.x / 2.3.x

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

hlevinson

  • I post occasionally
  • **
  • Posts: 53
  • Karma: 3
Re: how to retrieve a custom table field value?
November 19, 2009, 11:34:37 am
I have a similar need to return custom field values.

I am able to retrieve the custom field data using

Code: [Select]
civicrm_contact_get()

when I know the field number. But that means hardcoding the field number in my app.

So I'm just wondering if in CiviCRM v. 3.x

1. There is now a better way to do this, or
2. Do you anticipate that CustomField.php might be patched to include the getCustomFieldId() function?

I know I can do the code override described in the ACL article myself, but don't want to if there's a better way.

thanks


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: how to retrieve a custom table field value?
November 19, 2009, 08:23:03 pm

ive asked chris (xur1z) to create an issue and a patch for this. if he does so, we'll include it in 3.1 :)

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

hlevinson

  • I post occasionally
  • **
  • Posts: 53
  • Karma: 3
Re: how to retrieve a custom table field value?
November 20, 2009, 07:10:50 am
thanks Lobo

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • how to retrieve a custom table field value?

This forum was archived on 2017-11-26.