How to extend a core bean?


I am trying to change the behavior of a given method of Task bean.

So, I’ve written a Task.php file with a CustomTask class, which extends the Task class, and coded the overriding method.

Now, I am strugling to find where to put my Task.php so this customization be upgrade safe.

I’ve tried so far at custom/modules/Taks and custom/Extension/modules/tasks.

Any advice?

I’ve also tried this SugarCRM tip:

No success at all.

Basically you call the custom class from a custom controller with an overriding method.

Thanks. But the problem remains: where to put the files? I’ve reached that article, it’s pretty much what I have done - written a new bean derived from the original bean.

Where to put the files? How to make sure the new bean is being used instead of the original one?

Besides, I believe there is an easier way of doing that, with no need to rewrite the controller. If I change modules.php and replace Task.php by the CustomTask, it works - but it’s not upgrade safe.

So, there should be a way to extend module.php and indicate the new class for the Task bean,


I believe it is always going to read the modules/Task/Task.php before it reads any customization added to it. The custom controller way works though. You can test it easily by adding a $GLOBALS[‘log’]->debug(‘my custom class is being used’) to the overriding get_list_view_data.

Done that. It’s not being called.

The file modules.php has 2 entries:

$beanFiles[‘Task’] = ‘modules/Tasks/Task.php’;
$beanList[‘Tasks’] = ‘Task’;

If I rewrite the lines as below:

$beanFiles[‘Task’] = ‘custom/modules/Tasks/Task.php’;
$beanList[‘Tasks’] = ‘CustomTask’;

it works but is not upgrade safe. There should be a way to modify that in an upgrade safe fashion.

Which is pretty much what the guy on this thread suggested to change. It, however, is intended for SugarCRM (I don’t know the version) and probably the directories structure where to put the files is now different from SuiteCRM.


I just tried that way too and it does work without the custom controller. Put the beanList file in custom/Extension/application/Ext/Include/<somescript.php> just like it says. Run a quick repair and it should pick it up unless there’s a permission issue.

1 Like

After some trying and failing it finally worked. This is what I did when I wanted to override the AOW_WorkFlow module in SuiteCRM :

Create file:

Content of the file is:

$beanList['AOW_WorkFlow'] = 'AOW_WorkFlowCustom';
$beanFiles['AOW_WorkFlowCustom'] = 'custom/modules/AOW_WorkFlow/AOW_WorkFlow.php';

Create file:

Content of the file:



class AOW_WorkFlowCustom extends AOW_WorkFlow
     * AOW_WorkFlow constructor.
     * @param bool $init
    public function __construct($init = true)
		$GLOBALS['log']->debug("Yey! Overridden AOW_WorkFlow bean constructed");

Run Repair and rebuild

And that is all. You can now customize the module the way you want. This should work for any module.