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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • creating custom fields via api
Pages: [1]

Author Topic: creating custom fields via api  (Read 754 times)

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
creating custom fields via api
November 23, 2013, 08:34:24 pm
I noticed an issue when creating custom fields via api which is not easy to work around. in my case -- I have a module that will be installed on multiple sites and which creates a series of custom fields on install. so I have a lovely array to map out the creation of the custom data set and fields. and I can cycle through and create them no problem.

the issue is that while I can pass a "name" param to the custom data set/group and it will be preserved, passing a "name" param when creating the custom field does nothing -- the name is auto-generated based on the label value.

that's problematic because I often want to reference the created fields using my master array, or if I'm doing work with the fields, want to have a reliable name to reference them by. I suppose I could run my original label value through the function that auto-generates the custom field name, but that's kind of a lousy way to handle things.

any known workarounds? or interest in allowing the name to be passed?
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: creating custom fields via api
November 23, 2013, 09:55:50 pm
I agree that name should be a supported param.
Try asking your question on the new CiviCRM help site.

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: creating custom fields via api
November 24, 2013, 08:06:04 am

seems like a bug in the BAO code. wanna file an issue and a patch

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

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: creating custom fields via api
November 24, 2013, 01:08:02 pm
and a test (she says hopefully)
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

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: creating custom fields via api
November 25, 2013, 01:43:24 pm
http://issues.civicrm.org/jira/browse/CRM-13829
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: creating custom fields via api
November 25, 2013, 01:49:15 pm
so...
I went to file a PR and it turns out it was already fixed.
http://issues.civicrm.org/jira/browse/CRM-13089
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: creating custom fields via api
November 25, 2013, 01:54:06 pm
AND a test had already been done!
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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • creating custom fields via api

This forum was archived on 2017-11-26.