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 »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Should default values be set when creating records via profile?
Pages: [1]

Author Topic: Should default values be set when creating records via profile?  (Read 533 times)

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Should default values be set when creating records via profile?
September 13, 2013, 10:00:27 am
I have several clients who use default values on custom fields.  For instance, one client has a "Do Not Solicit" field that defaults to "No".  Another has an option for users who have opted out of appearing in a member directory (which is implemented with Views).

Unfortunately, when a new contact is created via a profile (for instance, by making a contribution), the default values aren't set - which means that these records don't appear in relevant searches.  They'll be set if you include the field on the profile - but in most cases, these are fields for back-office use, and we don't want contacts to be able to change them on their own.

I recently opened a bug (CRM-13376) regarding this.  However, I got the response, "I don't think we should set default values if fields are not included in profile."  I think there are several good use cases for setting default values for fields not included on the profile, but maybe there's a better way to set this up?  Also, I'm not sure what the use cases are for NOT setting a default custom field value when creating a record via profile.  Do folks have thoughts to share?
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

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: Should default values be set when creating records via profile?
September 13, 2013, 10:52:00 am

I think u can interpret default values in two ways:

a. default values in the database
b. default values in the UI

I think when we did implement the below (in v1.x, so 6+ years ago), we chose the latter.

I tend to agree with you that it should be interpreted as both. However, i suspect we'll need to do it at the DB level in addition to the UI

For the short term, you can potentially get away by running some alter statements on your DB to set the default values at the DB layer

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) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Should default values be set when creating records via profile?

This forum was archived on 2017-11-26.