I’ve got several questions like this in the past….
I’ve exported records from a module, but I’m getting all of the database values for my drop down fields instead of the display fields. How can I fix this?
This is easily fixable with the new exportSanitize() method available for SugarFields. The inverse of it’s counterpart importSanitize(), it allows you to format the value coming back from the database to match some the end user is more expecting. Here’s an example of how to use this method to leverage the formatField method to return the display value for a field if it exists.
Note this method is only available in Sugar 6.7 and later. Earlier version will need to do non-upgrade safe modifications to the export_utils.php file to do this.