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

Parents
  • 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?

  • All changes in the dropdown editor are saved for a specifiv dropdown in the file  <lang>_<sugar>_<dropdown>.php, which is in your  example en_us.sugar_testEP_templates_detail_list.php .

    So, when you deploy your dropdown in a file with that name, it overwrites the current defintion within Sugar - that means all manual changes are overwritten. If you use any other name the two files are merged but you do not know in which order.

Reply
  • All changes in the dropdown editor are saved for a specifiv dropdown in the file  <lang>_<sugar>_<dropdown>.php, which is in your  example en_us.sugar_testEP_templates_detail_list.php .

    So, when you deploy your dropdown in a file with that name, it overwrites the current defintion within Sugar - that means all manual changes are overwritten. If you use any other name the two files are merged but you do not know in which order.

Children