How to import a large dropdown?

Hi.  I've followed the instructions on this post  How to import dropdown values but the dropdown list isn't being updated. I have posted on that thread asking for help but I assume that as it's marked as 'answered' that it's being overlooked.

Not sure where I'm going wrong, if anyone could help I'd really appreciate it.

Manifest:

<?php

$manifest = array (
'built_in_version' => '13.0',

'acceptable_sugar_versions' => array(
'regex_matches' => array(
'7\\.9\\..+$',
'7\\.10\\..+$',
'7\\.11\\..+$',
'8\\.[0-9]\\..+$',
'9\\.[0-9]\\..+$',
'10\\.[0-9]\\..+$',
'11\\.[0-9]\\..+$',
'12\\.[0-9]\\..+$',
'13\\.[0-9]\\..+$',
),
),

'acceptable_sugar_flavors' => array (
0 => 'ENT',
1 => 'ULT',
2 => 'PRO',
),

'readme' => '',
'key' => '',
'author' => 'jk',
'description' => 'test dropdown import',
'icon' => '',
'is_uninstallable' => true,
'name' => 'test_dropdown_import',
'published_date' => '2023-08-16 16:00:01',
'type' => 'module',
'version' => 1.9,
'remove_tables' => 'prompt',
);

$installdefs = array (
'id' => 'test_dropdown_import',
'language' =>
array (
0 =>
array (
'from' => '<basepath>/custom/Extension/application/Ext/Language/en_UK.testEP_templates_detail_list.php',
'to_module' => 'application',
'language' => 'en_UK',
),
),
);


en_UK.testEP_templates_detail_list.php contains

<?php

$app_list_strings['testEP_templates_detail_list']'P00'=>'Link records';
$app_list_strings['testEP_templates_detail_list']'P01'=>'Verbal advice given';
$app_list_strings['testEP_templates_detail_list']'P02'=>'Memo';
$app_list_strings['testEP_templates_detail_list']'P04'=>'Abatement Notice S80';
$app_list_strings['testEP_templates_detail_list']'P05'=>'Enforcement Notice Section 34';
$app_list_strings['testEP_templates_detail_list']'P06'=>'Notice Letter';

Thanks in advance.

James

  • Hi James,

    for your en_UK.testEP_templates_detail_list.php file. The part that doesn't look good is the 'P00' portion. I believe referencing the url you provided you were copying similar to what they had which was [0][1] etc.. Those numbers represents the placement within the array.

    For your file can you try,

    $app_list_strings['testEP_templates_detail_list']=array (
    'P00'=>'Link records',
    'P01'=>'Verbal advice given',
    'P02'=>'Memo',
    'P04'=>'Abatement Notice S80',
    'P05'=>'Enforcement Notice Section 34',
    'P06'=>'Notice Letter',
    );
  • Hi Kortnee.  Thanks very much for replying, I loaded the new package (and got the success message) but I'm afraid the dropdown is still empty.  

  • Ok, can you confirm if you go to the Dropdown Manager that your dropdown exists? Look for testEP_templates_detail_list and open the dropdown. Once you've open the dropdown, just click save, i've had to do that sometimes and works after that.

    Navigating to Dropdown Editor

    1. Log In: Log in to your SugarCRM instance as an administrator.

    2. Admin Panel: Navigate to the Admin panel by clicking on the "Admin" link usually located in the top-right corner of your dashboard.

    3. Developer Tools: Under the 'Developer Tools' section, look for an option labeled "Dropdown Editor" and click on it.

  • After you check that the dropdown exists, as  suggested, did you make sure that the field you tested this on is pointing to the same dropdown list name?

    Also, for good measure, did you do a QRR (Quick Repair and Rebuild)?
    Admin->Repair->Quick Repair and Rebuild.
    I believe package loader should take care of that but it can't hurt to do another and recheck the values in the Dropdown Editor

    FrancescaS

  • Thanks again Kortnee.  The dropdown is definitely in the dropdown editor. I tried a QRR and it was still blank. Then when I clicked save as you suggest it did hang for a second giving me hope, but alas, still showing as empty.

  • Hi Francesca, thanks for responding. I've tried Kortnee's suggestion re: saving again, and I did try a QRR but that's not seemed to help.

    I hadn't actually tried using that list yet with a field, I'd just been looking at the dropdown editor.  I have tried that just in case, but the list is empty.

    James

  • Can you post the contents of your updated file: custom/Extension/application/Ext/Language/en_UK.testEP_templates_detail_list.php please?

    The original one you had in the install file (as above and pointed out by ) contained invalid PHP code which would have prevented it loading the data into the list. Maybe we should just rule out that as a cause again.

    Thanks,

    JH.

  • Hi John.  I've commented out the code form my original post and used the suggested alternative. The file is as follows:

    <?php

    $app_list_strings['testEP_templates_detail_list']=array (
    'P00'=>'Link records',
    'P01'=>'Verbal advice given',
    'P02'=>'Memo',
    'P04'=>'Abatement Notice S80',
    'P05'=>'Enforcement Notice Section 34',
    'P06'=>'Notice Letter',
    );
    // $app_list_strings['testEP_templates_detail_list']'P00'=>'Link records';
    // $app_list_strings['testEP_templates_detail_list']'P01'=>'Verbal advice given';
    // $app_list_strings['testEP_templates_detail_list']'P02'=>'Memo';
    // $app_list_strings['testEP_templates_detail_list']'P04'=>'Abatement Notice S80';
    // $app_list_strings['testEP_templates_detail_list']'P05'=>'Enforcement Notice Section 34';
    // $app_list_strings['testEP_templates_detail_list']'P06'=>'Notice Letter';
    // $app_list_strings['testEP_templates_detail_list']'P07'=>'Notice breach letter';

  • You should always provide a language file in the default language en_us before you try to set local customizations. This default language file is used for all languages as a defining base. If the default file is not available it may happen that you do not get any dropdown value.

    So, just create the file en_us.testEP_templates_detail_list.php with the following content (I corrected the wrong array syntax in your code):

    <?php
    $app_list_strings['testEP_templates_detail_list'] = array(
    	'P00'=>'Link records',
    	'P01'=>'Verbal advice given',
    	'P02'=>'Memo',
    	'P04'=>'Abatement Notice S80',
    	'P05'=>'Enforcement Notice Section 34',
    	'P06'=>'Notice Letter',
    );

    You may also write the dropdown values line by line in the form:

    <?php
    $app_list_strings['testEP_templates_detail_list'] = array();
    $app_list_strings['testEP_templates_detail_list']['P00']='Link records';
    $app_list_strings['testEP_templates_detail_list']['P01']='Verbal advice given';
    $app_list_strings['testEP_templates_detail_list']['P02']='Memo';
    $app_list_strings['testEP_templates_detail_list']['P04']='Abatement Notice S80';
    $app_list_strings['testEP_templates_detail_list']['P05']='Enforcement Notice Section 34';
    $app_list_strings['testEP_templates_detail_list']['P06']='Notice Letter';

    After a Quick Repair & Rebuild the dropdown should be available like is was in my environment.

    In the manifest you should change the en_UK values to en_us too.

  • Brilliant. Thank you Harald, I see where I was going wrong now.  If you don't mind, how would I then update a list, is that possible?