Using exportSanitize to make the exported value for a field look nicer

John Mertic —  November 4, 2013 — Leave a comment

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.

John Mertic


John Mertic manages the strategic ISV alliances program for SugarCRM, having several years of techincal experience bringing solutions to market with several SugarCRM technology partners. A frequent conference speaker and an avid writer, he has been published in php|architect, IBM Developerworks, and in the Apple Developer Connection, and is the author of the book 'The Definitive Guide to SugarCRM: Better Business Applications' and the book 'Building on SugarCRM: Creating Applications the Easy Way'. He is also president of the OpenSocial foundation, guiding them in solving interoperability issues for enterprise application providers worldwide.

No Comments

Be the first to start the conversation!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s