Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Change default value for standard field drop down

  1. #1
    edub is offline Sugar Community Member
    Join Date
    Jun 2008
    Posts
    55

    Default Change default value for standard field drop down

    On 4.5.1 I was able to edit the vardefs.php file located at /modules/Cases/vardefs.php and added:
    'default' => 'P3',
    to the priority array and that made the standard (built-in) field for Priority on the cases module select P3. This isn't working on v5 after the upgrade. I tried editing the same file on v5, but that didn't work, and then I found a forum post that made it sound like I need to create a file /custom/modules/Cases/Ext/Vardefs/vardefs.ext.php that is a copy of the vardefs.php file and make the same change, but that didn't work. Finally I saw a Wiki at:
    https://www.sugarcrm.com/wiki/index....Customizations
    so I added the following to the bottom of the file:
    $dictionary['Cases']['fields']['priority']['default'] = 'P3';
    but that didn't do it.

    Does anyone know the correct way to change the default value of a drop-down list when the field that the drop down list is for is a built-in field (not a custom field)?

  2. #2
    sugarcane is offline Sugar Community Member
    Join Date
    Apr 2005
    Location
    Chicago, IL
    Posts
    1,207

    Default Re: Change default value for standard field drop down

    Hello edub,

    In your case below, you need to create a file in custom/Extension/modules/Cases/Ext/Vardefs/vardefs.php NOT custom/modules/etc...

    Add the $dictionary['Cases']['fields']['priority']['default'] = 'P3';

    You will then need to rebuild extensions, and your change should take effect
    Intelestream has a great deal of experience hosting and customizing the SugarCRM application. Our company is made up by former employees of SugarCRM, and together we have over 50 years of experience working with the application. To learn more about us, please visit our website at www.intelestream.net or contact us directly at 800-391-4055 or by email at info@intelestream.net

  3. #3
    edub is offline Sugar Community Member
    Join Date
    Jun 2008
    Posts
    55

    Default Re: Change default value for standard field drop down

    Hmmm, I just tried that but it still didn't work. I wasn't sure if I needed the <? and ?> in the new vardefs.php file I created so I tried it both ways and it didn't work. I'm pretty sure I am suppose to have the <? and ?> because when I didn't have it the rebuild extensions module wrote out the dictionary definition a few times (plus I understand the theory of why it should be surrounded by those). But the good news is that it proved that the rebuild extensions script was seeing the vardefs file I created.

    I'm not sure what to try next or how to verify that the dictionary definition I added to that vardef file got put to the correct place after I run the rebuild extensions since I don't know where that correct place is.

    Any idea what I should try next?

  4. #4
    sugarcane is offline Sugar Community Member
    Join Date
    Apr 2005
    Location
    Chicago, IL
    Posts
    1,207

    Default Re: Change default value for standard field drop down

    Hi edub,

    yes, you do need to have your files begin with <?php and end with ?>

    So you file should look something like this:

    <?php

    $dictionary['Case']['fields']['priority']['default'] = 'P3';

    ?>

    then rebuild extensions and repair database and it should work.
    Intelestream has a great deal of experience hosting and customizing the SugarCRM application. Our company is made up by former employees of SugarCRM, and together we have over 50 years of experience working with the application. To learn more about us, please visit our website at www.intelestream.net or contact us directly at 800-391-4055 or by email at info@intelestream.net

  5. #5
    edub is offline Sugar Community Member
    Join Date
    Jun 2008
    Posts
    55

    Default Re: Change default value for standard field drop down

    I have everything exactly like you say, but it still isn't picking P3 (Priority 3) as the default item on the drop down list when you go to create a new case. I don't know what to do differently.

  6. #6
    tron90 is offline Sugar Community Member
    Join Date
    Jan 2010
    Posts
    19

    Default Re: Change default value for standard field drop down

    I want to accomplish the same thing... I tried to do it this way, but for some reason I get a blank screen after rebuilding extensions.

    I'm using version 5.5.1, has this procedure changed?
    Could you please tell me how to change the default priority?

    Thanks

  7. #7
    edub is offline Sugar Community Member
    Join Date
    Jun 2008
    Posts
    55

    Default Re: Change default value for standard field drop down

    I just tested this in Sugar 5.5.1 and it is the same in Sugar 5.5.1. In Sugar 6, you will be able to modify default fields from within Studio, which will make this much easier. Here is an example of what I just did to test this out. My test was to make the Website field in the Accounts module be a required field. First thing I did was to create a new file (not to modify an existing file) in the following folder:
    custom/Extension/modules/Accounts/Ext/Vardefs/
    you can call the file anything that ends in .php. So I called mine websiteRequired.php. If that folder path doesn't exist, just create it. Inside of that file, just put the following:

    <?php
    $dictionary["Account"]["fields"]["website"]["required"] = true;
    ?>

    Then run the rebuild extensions command. You said you got a blank screen when you tried to do that, which probably means you have a syntax error in one of the files in the custom/Extension/modules/*whatever*/Ext/Vardefs folder, but it could be in any module, not necessarily the one you are working on.
    Eric Wikman
    Sr Software Engineer
    Epicom

  8. #8
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: Change default value for standard field drop down

    Perhaps you should not name your file

    custom/Extension/modules/Cases/Ext/Vardefs/vardefs.php

    but

    custom/Extension/modules/Cases/Ext/Vardefs/myCaseSetting.php

    During repair all files in

    custom/Extension/modules/Cases/Ext/Vardefs/

    are collected and assembled to the new file

    custom\modules\Cases\Ext\Vardefs\vardefs.ext.php

    Perhaps you should delete that file before you start the next repair action.
    Last edited by kuske; 2010-06-21 at 07:52 AM.
    Harald Kuske
    Pre-Sales Engineer Central Europe

    SUGARCRM Deutschland GmbH
    Erika-Mann-Str. 53, 80636 Munich, Germany
    Email: hkuske@sugarcrm.com
    Home: http://www.sugarcrm.com


  9. #9
    Join Date
    Jun 2010
    Posts
    10

    Default Re: Change default value for standard field drop down

    Thanks for the solution my problem was solved
    Techstore for all your Website Design and Online Marketing needs

  10. #10
    tron90 is offline Sugar Community Member
    Join Date
    Jan 2010
    Posts
    19

    Default Re: Change default value for standard field drop down

    For some reason, mine is not working... I'm real new to Sugar, so I don't know what could be wrong.

    Here's exactly what I did:

    -Created a file named defaultPriority.php in custom/Extension/modules/Cases/Ext/Vardefs/
    Inside this file I have this:

    HTML Code:
    <?php
    
    $dictionary['Case']['fields']['priority']['default'] = 'P3';
    
    ?>
    -Repair extensions

    I still get a blank screen every time I access Cases. If I remove the file and repair extensions, Cases work fine again.

    Thanks for your help.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Default value for multiselect custom field
    By aliceroth in forum Help
    Replies: 2
    Last Post: 2010-07-02, 12:58 PM
  2. custom date field default to none
    By sidh211 in forum Help
    Replies: 0
    Last Post: 2008-06-02, 12:28 PM
  3. Replies: 3
    Last Post: 2007-12-18, 11:31 PM
  4. Replies: 0
    Last Post: 2005-04-28, 02:44 AM
  5. Search Screens - Having The Cursor Default To First Entry Field
    By CyberFerret in forum Feature Requests
    Replies: 1
    Last Post: 2005-02-08, 10:38 AM

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
  •