Results 1 to 5 of 5

Thread: Create a drop down in oppurtunities

  1. #1
    siva143viji is offline Sugar Community Member
    Join Date
    Jan 2007
    Posts
    14

    Default Create a drop down in oppurtunities

    hi

    I am trying to create a drop down in the edit view of the oppurtunities module but it is give me dupilcation error.

    Query Failed:INSERT into fields_meta_data set id='Opportunitiespayment_breakup_c', name='payment_breakup_c', label='Payment_Schedule_c_0', custom_module='Opportunities', data_type='enum', max_size='20', required_option='optional', default_value=null, date_modified='2007-01-30 16:56:17', deleted='0', audited='0', mass_update='0', ext1='payment_breakup', ext2='0', ext3='0'::MySQL error 1062: Duplicate entry 'Opportunitiespayment_breakup_c' for key 1

    I am new to sugarcrm and dont understand what all changes it is making in the database. Also i am not sure whether i should create the dropdown as a new custom field or somewhere else.It will be of great help if someone call let me know.

    Thanks in advance for the help

    Siva

  2. #2
    Barakanooz is offline Sugar Community Member
    Join Date
    May 2006
    Posts
    26

    Default Re: Create a drop down in oppurtunities

    siva,

    I have created a few drop downs by editing the code directly.

    These are the files I modified:
    /include/language/en_us.lang.php
    - This is where you can create the drop down menu with its contents.Scroll through the file you will see the standards ones..lead_source_dom, industry_dom, etc.. I created one called 'lic_type_dom' by putting the following code under the lead_source_dom
    'lic_type_dom' =>
    array (
    '' => '',
    'Contract' => 'Contract',
    'Evaluation' => 'Evaluation',
    'Free' => 'Free',
    'Inactive' => 'Inactive',
    'Major' => 'Major',
    'Purchase' => 'Purchase',
    'Storm' => 'Storm',
    ),

    You also need to create a column in the Database to hold the value you select from the Drop Down. For my lic_type_dom that I wanted to display on the Contacts module pages I made a column called 'license_type' in the contacts table.

    Then edit the vardefs.php file for the module that will display the drop down..
    'license_type' =>
    array (
    'name' => 'license_type',
    'vname' => 'LBL_LICENSE_TYPE',
    'type' => 'enum',
    'options' => 'license_type_dom',
    'len' => '25',
    'isnull' => 'false',
    ),

    Add the new DB column to the field_arrays.php file of the module you are adding the drop down to.
    , "license_type"

    Now you can start to display the drop down on the pages. For example to display the lic_type_dom when looking at a Contact you need to edit the EditView.php, EditView.html, DetailView.php, DetailView.html of the Contacts module.

    For EditView.php (add these lines, you should see similar entires so just put them next to those)
    $xtpl->assign("LICENSE_TYPE", $focus->license_type);
    $xtpl->assign("LICENSE_TYPE_OPTIONS", get_select_options_with_id($app_list_strings['lic_type_dom'], $focus->license_type));

    For EditView.html
    I display the drop down on the webpage by adding these lines:
    <tr>
    <td class="dataLabel"><slot>{MOD.LBL_LICENSE_TYPE} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
    <td class="dataField"><slot><select name='license_type' tabindex='1'>{LICENSE_TYPE_OPTIONS}</select></slot></td>


    For DetailView.php
    Add this line:
    $xtpl->assign("LICENSE_TYPE", $focus->license_type);

    For DetailView.html
    Add these lines
    <td valign="top" class="tabDetailViewDL"><slot>{MOD.LBL_LICENSE_TYP E}</slot></td>
    <td valign="top" class="tabDetailViewDF"><slot>{LICENSE_TYPE}</slot></td>

    Finally, you need to add the label to the modules specific language file so for the contacts module this would be /Contacts/language/en_us.lang.php
    Add the following:
    'LBL_LICENSE_TYPE' => 'License Type:',


    This might be more than you wanted and there are ways to created custom fields through a GUI but I have done all of my edits in code so that I can try to learn the system better. Let me know if you have any troubles. Maybe someone can post the GUI way.

  3. #3
    siva143viji is offline Sugar Community Member
    Join Date
    Jan 2007
    Posts
    14

    Default Re: Create a drop down in oppurtunities

    Thank you.

    This what i wanted to know more than the GUI.This makes more sense to me than the GUI. I got confused with GUI and i made changes in the code and didnt know where all i need to make changes.This perfectly answers my question

    Thank you

    Siva

  4. #4
    siva143viji is offline Sugar Community Member
    Join Date
    Jan 2007
    Posts
    14

    Default Re: Create a drop down in oppurtunities

    hi

    i followed the steps that you told me but it works for the most part gives me an error saying

    Parse error: syntax error, unexpected T_DOUBLE_ARROW in C:\Documents and Settings\sumakesan\Desktop\cm\SugarCRM\custom\modu les\Opportunities\language\en_us.lang.php on line 6

    and even if i change it it give me error.But the drop down is populated correctly it is just the name not being dispalyed properly because of this error

    I want to create the drop down box in create oppurtunities page. I was hoping that it is similar but it is not. I am extremely sorry for the wrong information. Can you please tell me how to create the drop down in create oppurtunities page instead of the oppurtuniites page. I would really apprecitae your help

    Siva

  5. #5
    siva143viji is offline Sugar Community Member
    Join Date
    Jan 2007
    Posts
    14

    Default Re: Create a drop down in oppurtunities

    hi

    sorry for the trouble it worked i was editing a wrong file that is reason for all the preoblems now everything is working

    Thank you
    siva

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. add the contents of 4 drop down list in one field
    By Spy123 in forum Developer Help
    Replies: 0
    Last Post: 2007-01-24, 11:06 AM
  2. Drop Downs behave strangely...
    By roblaus in forum Help
    Replies: 3
    Last Post: 2006-12-29, 03:31 PM
  3. Strage drop down list behaviors...
    By Tinman4444 in forum Help
    Replies: 3
    Last Post: 2006-10-23, 08:43 PM
  4. Replies: 0
    Last Post: 2006-03-17, 06:58 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
  •