Results 1 to 4 of 4

Thread: DateTime Custom Field ?

  1. #1
    spencer134 is offline Junior Member
    Join Date
    Jul 2008
    Posts
    1

    Default DateTime Custom Field ?

    First of all I'm new with SugarCRM so pardon me if I ask newbie question I did try searching for an answer but did not find one.

    Is there a DateTime custom field? I can only see Date field when I try adding custom fields to Leads, Accounts, etc.
    I'm looking at: Developer Tools > Studio

    Thanks!

  2. #2
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: DateTime Custom Field ?

    Quote Originally Posted by spencer134
    First of all I'm new with SugarCRM so pardon me if I ask newbie question I did try searching for an answer but did not find one.

    Is there a DateTime custom field? I can only see Date field when I try adding custom fields to Leads, Accounts, etc.
    I'm looking at: Developer Tools > Studio

    Thanks!
    Not in studio but you can create one

    I created my field as a time field but then went to vardefs & set it to be a datetime field

    'date_start' =>
    array (
    'required' => false,
    'name' => 'date_start',
    'vname' => 'LBL_DATE_START',
    'type' => 'datetime',
    'massupdate' => 0,
    'comments' => '',
    'help' => '',
    'duplicate_merge' => 'disabled',
    'duplicate_merge_dom_value' => 0,
    'audited' => 0,
    'reportable' => 0,
    'len' => '25',
    ),
    I then changed the type in mysql to datetime

    I also changed metadata/editviewdefs.php

    array('name'=>'date_start', 'type'=>'datetimecombo','label'=>'LBL_DATETIME_STA RT',),

    It's a bit fiddly but it works

    Lastly because sugar makes datetime fields a drop down of hours & a dropdown of minutes in quarter hour intervals I edited include/SugarFields/Fields/DateTimecombo/Datetimecombo.js so that I can enter time in the format HH:MM
    Mike Solomon
    Development Manager
    Ivy Ltd
    www.ivy.ltd.uk]www.ivy.ltd.uk

    php version 5.2.6
    MySql 5.1.59

  3. #3
    lachmac is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    30

    Default Re: DateTime Custom Field ?

    Hi,

    I implemented this in Sugar 5.5. It works, but I cannot get the field to save empty, i.e. if I leave the field empty it will save 2000-01-01 00:00.

    Any ideas?

    In your instruct I see that

    Quote
    I also changed metadata/editviewdefs.php

    array('name'=>'date_start', 'type'=>'datetimecombo','label'=>'LBL_DATETIME_STA RT',),
    Unquote

    How come you label it 'LBL_DATETIME_STA RT and not just LBL_DATE_START?

    Regards,

  4. #4
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: DateTime Custom Field ?

    Quote Originally Posted by lachmac View Post
    I implemented this in Sugar 5.5. It works, but I cannot get the field to save empty, i.e. if I leave the field empty it will save 2000-01-01 00:00.

    Any ideas?
    Make sure your SQL field definition allows NULL and that the default (in studio and SQL) is empty or Null.

    Not certain this is the only problem as your default date is odd, but Sugar behavior is that when a field is empty it fills in using the default.

    Phil

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. upgraded to 4.5.1e, received "Metadata for table tracker does not exist"
    By sfgeorge in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2007-09-03, 02:24 PM
  2. Custom Field add not visible is Edit Layout
    By tylerpoint in forum Help
    Replies: 0
    Last Post: 2007-07-09, 05:56 AM
  3. custom field -> dateTIME not just date
    By elRey in forum Developer Help
    Replies: 6
    Last Post: 2006-11-20, 10:06 PM
  4. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  5. Replies: 7
    Last Post: 2006-06-06, 07:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •