Results 1 to 5 of 5

Thread: Default Values for Built-in Fields?

  1. #1
    pterrell is offline Sugar Community Member
    Join Date
    Dec 2006
    Posts
    31

    Default Default Values for Built-in Fields?

    Is there a way to have default values for the built-in fields? I'm looking and searching, and don't see a way.

    I'd really like the default value of the Last Name field to be a timestamp of Now(). The sales team is getting inbound calls from the outsourced telemarketing team. A "New Lead" is created for each inbound call, but often a salesperson doesn't talk long enough to get a last name. Since the last name is required and I need a "visible" indicator of what calls were good or bad, I would love to "kill two birds with one stone".

  2. #2
    leenwebb is offline Sugar Community Member
    Join Date
    Nov 2006
    Location
    New Hampshire
    Posts
    77

    Default Re: Default Values for Built-in Fields?

    I've done similar things directly in the EditView PHP and HTML files.

    Here's a rundown of an example in leads:

    - In custom/working/modules/Leads/EditView.html, find the Last Name field and make its default something like {DEFAULT_NOW}. Go to studio and save+publish so the file is propgated to all the correct places.

    - In modules/Leads/EditView.php, make a nice little if() statement that says something like "if last_name is NULL, then xtpl->assign('default_now',now());"

    That should work. As a side note: in Leads/vardefs.php, you can tell it that last_name isn't required. I don't know if, overall, that would be a better solution to your problem.

    Good luck!
    Eileen

  3. #3
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Default Values for Built-in Fields?

    You should also be able to do it at the database level and assign NOW() as the default value for the column in question. That way you wouldn't have to mess with the HTML/PHP code.
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  4. #4
    pterrell is offline Sugar Community Member
    Join Date
    Dec 2006
    Posts
    31

    Default Re: Default Values for Built-in Fields?

    Eileen and Angel,

    Thank you both for your suggestions. I'll use both of them. I prefer Eileen's suggestion of rewriting the code because it would be best to give feedback to the user that the last name doesn't need to be filled in as part of the initial process. But since I'm still learning how to work with PHP and I see the default values exposed in phpMyAdmin, I'll start with Angel's suggestion first.

    I think for now it's best to make the last name mandatory for the the setup on this client.

  5. #5
    aneal is offline Junior Member
    Join Date
    Apr 2007
    Posts
    1

    Default Re: Default Values for Built-in Fields?

    Does anyone know if they are slating this to be added to the GUI - in Studio instead of having to make changes to the code? It would be beneficial to just a have a check box and or the first field listed in the drop down to be the default and or the same thing to make the field required.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 2006-10-18, 12:47 AM
  2. Help! Problems upgrading to version 4.0
    By ricardod in forum Help
    Replies: 1
    Last Post: 2006-01-16, 06:39 PM
  3. SugarCrm 4.0 Patch
    By mgamboa in forum General Discussion
    Replies: 0
    Last Post: 2005-12-21, 04:14 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
  •