SugarCRM: Upgrade Safe Way to Extend Views

sugarcrmdevelopers —  March 28, 2012

Extending Views is fun and easy to do, but did you know there is a right way and a wrong way to extend module views.  Well I shouldn’t say wrong as it still works but it’s non-upgrade safe, and from my experience it will cause you headaches after you do an upgrade and something is not working correctly.  Click Read More to see what I’m talking about.


Lets say you have this file for in your custom/modules/Contacts/views/view.detail.php

While it will work, if SugarCRM ever updated the base file in modules/Contacts/views/view.detail.php you wont have the new functionality that was put into place.  If we write the view like this

Not only are we upgrade safe, it’s much cleaner in the long run as you don’t have to copy any form the base class over.

No View Defined In Module

What if the module does have a view.detail.php or a view.edit.php in the modules//views folder.  Well don’t worry, it’s still very easy to do.  Just override the base view class.  But after an upgrade make sure that there wasn’t one added if it’s a OOB module.

I can only hope this helps people write better customizations.