I am using SugarCrm community edition 6.5. I have created 1 Dropdown . Now i wanted to update all previous records with a particular dropdown field.
I have noticed that even when you create a new field in Studio with a default value, it does not put that default in the current rows in the table.
How I have dealt with this is to go to the custom table for that module and run an UPDATE statement on it. For example, if you created a field called new_field in module MyModule, then the table would be called my_module_c and the field would be new_field_c and it would look something like this [assuming MySQL database in MySQL Workbench]:
SET SQL_SAFE_UPDATES=0; -- needed to update in Workbench
SET new_field_c = 'NewValue'
WHERE new_field_c IS NULL; -- makes sure that you don't overwrite any data
I have not tried this, but another options might be to run a PHP script that loops through all of the records like this:
$accountBean = BeanFactory::getBean("MyModule");
// Grab all the records
$accountsBeanList = $accountBean->get_list();
// Process all the beans
foreach ($accountsBeanList["list"] as $focus)
$focus->new_field_c = NewValue;
Hope this helps
Retrieving data ...