Results 1 to 5 of 5

Thread: How to set default value and help text for stock fields?

  1. #1
    maxlui is offline Member
    Join Date
    Apr 2010
    Posts
    5

    Default How to set default value and help text for stock fields?

    How do I set the default value and Help Text of a out of the box / stock field say in the Accounts module?

    Is there a reference guide to show me how to customize OOB fields in the existing modules in general?


    version 5.5.1 CE

  2. #2
    chinwoei's Avatar
    chinwoei is offline Sugar Community Member
    Join Date
    Jul 2007
    Posts
    91

    Default Re: How to set default value and help text for stock fields?

    Quote Originally Posted by maxlui View Post
    How do I set the default value and Help Text of a out of the box / stock field say in the Accounts module?

    Is there a reference guide to show me how to customize OOB fields in the existing modules in general?


    version 5.5.1 CE
    Hi,

    you may build a install package that include all your OOB fields customizations and install it to your instance.
    Here is a simple tutorial to teach how to customize SugarCRM OOB fields.

    Hope it answer your question.
    I am from iZeno Pte Ltd
    Personal Site: Technical Sharing
    SugarForge Project:
    iZeno SMS : http://www.sugarforge.org/projects/izeno-sms/

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

    Default Re: How to set default value and help text for stock fields?

    Quote Originally Posted by chinwoei View Post
    Hi,

    you may build a install package that include all your OOB fields customizations and install it to your instance.
    Here is a simple tutorial to teach how to customize SugarCRM OOB fields.

    Hope it answer your question.
    Chinwoei,

    Why do you build an install package rather than creating an extension in place? Is there an advantage I don't know about?

    If you're going to install this on several systems an install package is better. But for a single system I would just create the file in place to define the default value and help text.

    Here is my file <sugarroot>/custom/Extension/modules/Accounts/Ext/Vardefs/custom.php that changes the country fields to dropdowns:
    PHP Code:
    <?php
      $dictionary
    ['Account']['fields']['billing_address_country']['type'] = 'enum';
      
    $dictionary['Account']['fields']['billing_address_country']['options'] = 'countries_dom';
      
    $dictionary['Account']['fields']['shipping_address_country']['type'] = 'enum';
      
    $dictionary['Account']['fields']['shipping_address_country']['options'] = 'countries_dom';
    ?>
    You can do the same thing to set the default and help values for a field something like:
    PHP Code:
    <?php
      $dictionary
    ['Account']['fields']['billing_address_country']['help'] = 'This is the country for the billing address';
      
    $dictionary['Account']['fields']['billing_address_country']['default'] = 'U.S.A.';
    ?>
    Just add the file and do a Quick Repair and Rebuild. If it doesn't do what you want, delete or rename the file something other than .php and repair again and it will restore it the way it was while you sort out the problems.

    If there is an advantage to the install package let me know, but a single extension file seems simpler.

    Phil

  4. #4
    chinwoei's Avatar
    chinwoei is offline Sugar Community Member
    Join Date
    Jul 2007
    Posts
    91

    Default Re: How to set default value and help text for stock fields?

    Quote Originally Posted by datasponge View Post
    Chinwoei,

    Why do you build an install package rather than creating an extension in place? Is there an advantage I don't know about?

    If you're going to install this on several systems an install package is better. But for a single system I would just create the file in place to define the default value and help text.

    Here is my file <sugarroot>/custom/Extension/modules/Accounts/Ext/Vardefs/custom.php that changes the country fields to dropdowns:
    PHP Code:
    <?php
      $dictionary
    ['Account']['fields']['billing_address_country']['type'] = 'enum';
      
    $dictionary['Account']['fields']['billing_address_country']['options'] = 'countries_dom';
      
    $dictionary['Account']['fields']['shipping_address_country']['type'] = 'enum';
      
    $dictionary['Account']['fields']['shipping_address_country']['options'] = 'countries_dom';
    ?>
    You can do the same thing to set the default and help values for a field something like:
    PHP Code:
    <?php
      $dictionary
    ['Account']['fields']['billing_address_country']['help'] = 'This is the country for the billing address';
      
    $dictionary['Account']['fields']['billing_address_country']['default'] = 'U.S.A.';
    ?>
    Just add the file and do a Quick Repair and Rebuild. If it doesn't do what you want, delete or rename the file something other than .php and repair again and it will restore it the way it was while you sort out the problems.

    If there is an advantage to the install package let me know, but a single extension file seems simpler.

    Phil
    Hi Phil,

    no different between the both methods that we mention above.
    The only different, does the poster have the permission to login into the server.
    If yes, your method will be the faster and easier way to deploy (I am using the same method that you suggest).
    I am from iZeno Pte Ltd
    Personal Site: Technical Sharing
    SugarForge Project:
    iZeno SMS : http://www.sugarforge.org/projects/izeno-sms/

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

    Default Re: How to set default value and help text for stock fields?

    Quote Originally Posted by chinwoei View Post
    Hi Phil,

    no different between the both methods that we mention above.
    The only different, does the poster have the permission to login into the server.
    If yes, your method will be the faster and easier way to deploy (I am using the same method that you suggest).
    Ah! A hosted server. I get it.

    I guess I just live a sheltered existence. I maintain my own server and do whatever I want so I don't need to worry about such things

    Thanks for the explanation.

    Phil

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 2010-04-13, 10:31 PM
  2. Adding Custom Fields to Stock Modules
    By wrboyce in forum Developer Help
    Replies: 3
    Last Post: 2009-04-01, 02:34 PM
  3. Hiding standards fields of a stock module
    By DN667 in forum Developer Help
    Replies: 17
    Last Post: 2009-03-12, 03:18 PM
  4. Add default text to a quote
    By JVWay in forum Help
    Replies: 1
    Last Post: 2008-07-17, 09:13 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
  •