Remove Values in a Drop-down List Through Code

By
Last Modified Date

In SugarCRM, if you aspire to remove values from a drop-down list through code in an upgrade safe manner, follow the steps mentioned below.

For Default Drop-downs

Create a file named ‘en_us.dropdownName.php’ under ‘custom/Extension/application/Ext/Language’ folder. Get the existing drop-down 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 drop-down 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 look 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 Drop-down (Through Studio)

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

 

Rolustech is a SugarCRM Certified Developer & Partner Firm. We have helped more than 700 firms with various SugarCRM integrations and customization. Get in touch today for your FREE Business Analysis. We will be happy to assist you!

Need Help? Get Free Consultation


By clicking you agree to our Terms and Conditions

Send me news and updates

Get in touch


Contact Information