Overriding Modules in Creatio (formerly bpm’online)

A key part of developing in Creatio is the concept of overriding to add or change functionality. This is easily done with view modules. As a matter of fact, this is exactly what the wizards are doing when you customize an existing section or page. You can do this as well by creating a “Replacing Client Module” and selecting the existing view module as the parent. However this is not possible with core modules. What’s the difference in these module types? Creatio has two types of modules: “visual modules” (view module schemas) and “non-visual modules” (module schema). View modules are the ViewModule (VM) part of the MVVM pattern implemented in Creatio. The contain the UI elements that make up something you see in Creatio. A page is a view module. A module contains functionality not associated with data binding or data display in the UI. It is the latter, module schemas, that you are prevented from replacing in Creatio. If you attempt to create a replacing client schema of a module, you’ll see the following error saying “substitution of modules is not allowed”:

This is done intentionally to preserve the core functionality that makes up Creatio. This was changed in version 7.13, previously, you were cautioned against replacing modules, however, you were still allowed to do so. In current versions of Creatio (since 7.13) you’re unable to replace modules. However, you can create a new module that overrides an existing module. Let’s take a look at how to do this.

For this example, we’ll be creating a new module to override the QuickFilterModuleV2 module. Once we’ve overridden the QuickFilterModuleV2 module, we can override functions contained in that module.

First, create a new Module schema (not a replacing client schema). Add in the following code (also set the name/title of the module as UsrQuickFilterModuleV2), do not set a parent for the module:

define("UsrQuickFilterModuleV2", ["QuickFilterModuleV2"],
function() {
	Ext.define("Terrasoft.UsrQuickFilterModuleV2", {
		override: "Terrasoft.QuickFilterModuleV2",
		
		// override functions in QuickFilterModuleV2 here
    
	});
});

In the module above, we’re creating a new module that overrides UsrQuickFilterModuleV2. They key here is the “override” line which specifies that this module overrides the one listed there, in this case Terrasoft.QuickFilterModuleV2. You can add any code to override functions in the out of the box QuickFilterModuleV2 module as needed. However, this is only one step in creating a module to override an existing module. We still need to load our new module so the system will apply ours as an override to the existing one. To do this, we’ll add our new module as an AMD module to BootstrapModulesV2. This is an entry point of the Creatio application, so with our module being loaded there, the override will be in place before the existing module is used.

To do this, this time create a Replacing Client Module. Select “BootstrapModulesV2” as the parent for the replacing module. Now add the following code:

define("BootstrapModulesV2", ["UsrQuickFilterModuleV2"], function() {
	return {};
});

By simply adding our new module to the modules list in BootstrapModulesV2, it will load our module and it will now override the existing one. Any override functions we put into place there will be executed instead of the existing ones in the out of the box code.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!