Sugar Bean Override Not Working

Hello Folks,

I am trying to override sugar bean for Leads module and somehow it is not working as expected. I did the same override for Cases and it worked well. Also, I have found out that this problem is coming if we have controller.php file in module directory. I tried overriding that as well but no luck.

Any help would be very much appreciated.

Just in case, if you want to review what I have done so far,


class CustomLead extends Lead {

public function __construct() {






  • Hi 

    You need to create an extended include (custom/Extension/application/Ext/Include/<somescript.php>) and add a code like that:


    $objectList['Leads'] = 'Lead';
    $beanList['Leads'] = 'CustomLead';
    $beanFiles['CustomLead'] = 'custom/modules/Leads/Lead.php';

    Then you have to create the script custom/modules/Leads/Lead.php. Inside this script you have to create the class CustomLead which inherit from regular Lead. Lastly you can override the method you want to.

    After doing all these tasks go to Admin -> Repair -> Quick Repair and Rebuild.

    Kind regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Thanks for the reply Andre. I have done that as well but as I mentioned, it is working fine for Cases and there is a problem only with Leads as I can see there is a controller.php file and this is the only difference between Cases and Leads modules directory.

  • Hi Andre,

    Your solution worked for me. Thank you.

    The only difference I can see in your solution is $objectList['Leads'] = 'Lead'; which was missing in mine.

    Not sure what difference does it make.

  • I know this is 3 years old now, but I've just had to do something similar so thought I'd share in case it's useful for anybody else searching.

    $objectList['Leads'] = 'Lead'; sets the object name for the Leads module (in my case I was extending the Surveys module so for me it was $objectList['Surveys'] = 'Surveys';).

    If you don't add that line, the object name for the Leads module becomes 'CustomLead' (or whatever you name your class), which breaks a lot of the existing functionality, particularly when trying to load related beans using get_linked_beans, but I'm sure it breaks other things too.