Results 1 to 8 of 8
Like Tree1Likes
  • 1 Post By andopes

Thread: Convert text field to a drop-down

  1. #1
    andromeda9 is offline Member
    Join Date
    Mar 2009
    Posts
    9

    Default Convert text field to a drop-down

    I would like to convert the rating field in Accounts to a drop-down in order to restrict what is entered into this field. There are several approaches in the forums so I am wondering what is the preferred way to do this.

    Thanks for the help in advance.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Convert text field to a drop-down

    Hi Andromeda

    Write this code into custom/Extension/modules/Accounts/Ext/Vardefs/vardefs.ext.php
    PHP Code:
    <?php
    $dictionary
    ['Account']['fields']['rating']['type'] = 'enum';
    $dictionary['Account']['fields']['rating']['options'] = 'dropdown_name';
    ?>
    Create the folders and file.
    Obviously update the dropdown_name to the appropriate dropdown name for rating.
    Got to Admin -> Repair -> Quick Repair and Rebuild

    Cheers
    lijith likes this.
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    terencelhl's Avatar
    terencelhl is offline Sugar Community Member
    Join Date
    Sep 2005
    Location
    Seri Kembangan, Selangor, Malaysia
    Posts
    43

    Thumbs up Re: Convert text field to a drop-down

    Quote Originally Posted by andopes View Post
    Hi Andromeda

    Write this code into custom/Extension/modules/Accounts/Ext/Vardefs/vardefs.ext.php
    PHP Code:
    <?php
    $dictionary
    ['Account']['fields']['rating']['type'] = 'enum';
    $dictionary['Account']['fields']['rating']['options'] = 'dropdown_name';
    ?>
    Create the folders and file.
    Obviously update the dropdown_name to the appropriate dropdown name for rating.
    Got to Admin -> Repair -> Quick Repair and Rebuild

    Cheers
    Hi Andopes,

    Thank you for the quick solution. Cheers.

  4. #4
    judgej is offline Sugar Community Member
    Join Date
    Feb 2007
    Posts
    58

    Default Re: Convert text field to a drop-down

    This worked a treat for me too.

    I did also need to "save and deploy" the basic and advanced search forms that had this field on, in order to change the search form field from the original text field to the dropdown. The "quick repair and rebuild" did not update that area. There may be another rebuild option that I'm not spotting.

    -- Jason

  5. #5
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: Convert text field to a drop-down

    Please check if this field has its type overwritten for some of theses layouts. Look for some code as 'type'=>'<any type>'
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  6. #6
    Join Date
    Sep 2011
    Posts
    8

    Default Re: Convert text field to a drop-down

    Thanks for this! I also tried to do a manual code edit. Here it is:

    1.) Go to custom\modulebuilder\packages\<module_name>\module s\<my_mod>\vardefs.php
    2.) Search the code of the field to be changed.

    PHP Code:
        'city' => 
        array (
          
    'required' => true,
          
    'name' => 'city',
          
    'vname' => 'LBL_CITY',
          
    'type' => 'varchar',
          
    'massupdate' => 0,
          
    'comments' => '',
          
    'help' => '',
          
    'importable' => 'true',
          
    'duplicate_merge' => 'disabled',
          
    'duplicate_merge_dom_value' => '0',
          
    'audited' => false,
          
    'reportable' => true,
          
    'len' => '20',
          
    'size' => '20',
        ), 
    3.) Change 'type' => 'varchar' to 'type' => 'enum'.

    4.) Add the ff properties to make it as a dropdown.
    PHP Code:
          'options' => 'dropdown_list',
          
    'studio' => 'visible',
          
    'dependency' => false
    5.) Go to module builder and press save.

  7. #7
    climbing-alien is offline Sugar Community Member
    Join Date
    Jul 2010
    Posts
    27

    Default Re: Convert text field to a drop-down

    Is it possible to do this as a module/extension that can be installed though the module loader? Running 6.3 through Sugar ondemand and I have no access to the file system.

    Thanks in advance!

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

    Default Re: Convert text field to a drop-down

    It is certainly possible. Simply create the file locally and then use the copy feature of the Module Loader package manifesto to copy it to the appropriate location on the remote file system.

    It would be similar to this technique:

    Angel's Blog: Logic Hooks: OnDemand Installations
    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)
    ______________________________________________

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Lead convert screen has country drop down
    By Mithun in forum Developer Help
    Replies: 4
    Last Post: 2009-06-02, 11:40 AM
  2. How to turn a text field into a drop down
    By buckalec in forum Help
    Replies: 9
    Last Post: 2009-04-02, 11:02 AM
  3. Replies: 1
    Last Post: 2008-09-05, 11:30 AM
  4. Replies: 1
    Last Post: 2008-01-24, 10:11 PM
  5. Replies: 2
    Last Post: 2007-07-08, 11:26 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
  •