Remove Values in a dropdown list through code

By
459 views

In sugar, if you aspire to remove values from dropdown list through code in upgrade safe manner, please follow the below-mentioned steps.

For Default Dropdowns

Create a file named ‘en_us.dropdownName.php’ under ‘custom/Extension/application/Ext/Language’ folder. Get the existing dropdown values from ‘include/language/en_us.lang.php’ file and placed them in the newly created file. Now just remove the desired values from that dropdown and run repair and rebuild.

For example if I want to remove blank value from ‘account_type_dom’ dropdown my ”en_us.account_type_dom.php’ file will looks like:

<?php
$app_list_strings[‘account_type_dom’] = array (
‘Analyst’ => ‘Analyst’,
‘Competitor’ => ‘Competitor’,
‘Customer’ => ‘Customer’,
‘Integrator’ => ‘Integrator’,
‘Investor’ => ‘Investor’,
‘Partner’ => ‘Partner’,
‘Press’ => ‘Press’,
‘Prospect’ => ‘Prospect’,
‘Reseller’ => ‘Reseller’,
‘Other’ => ‘Other’,
);
?>

 For Newly Created Dropdown (Through Studio)

Open ‘custom/include/language/en_us.lang.php’ and search your dropdown. Once you have your dropdown value array then just remove the desired values from it and run repair & rebuild.

Need Help? Get Free Consultation


captcha

Please leave this field empty.

Get in touch



captcha

Please leave this field empty.

Contact Information