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.

Warning Regarding Overriding BootstrapModulesV2

There is a warning to consider here. A pretty large one. There can only be one active override of BootstrapModulesV2 in the system. If you override it, other overrides will no longer be “active” – assuming your package is the lowest on the dependency hierarchy. Only the override of BootstrapModulesV2 in the lowest in the package hierarchy will be active. So, the best approach is to search your system for any other version of a BootstrapModulesV2 schema and then add/merge in the modules loaded in that one into yours as well. In some implementations, the Playbook feature in Creatio, as well as the map dashboard widget in the marketplace, uses a BootstrapModulesV2 override, so in order for that to work you’d need to merge the code from that override into yours.

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.

6 Comments

  1. Hi Team,

    I would need your expert advice in figuring out a solution in hiding/disabling the Select All option available in Action Menu in lookup pop-up.

    Based on the below listed community post, it is applied on the base object LookupPageViewGenerator and the changes would be affected everywhere. But what I want is to hide the “Select All” button specific to one detail. Other option of using hideActions attribute property is applied on lookup object and it also hides the whole Action button with New button as well.
    Lookup modal box customization | Community Creatio

    https://community.creatio.com/questions/lookup-modal-box-customization

    Reply
  2. Hi Ryan,

    I have tried the same for ‘CaseServiceUtility’ Mixin to override a method. But I am getting below error.
    I am getting 404 not found error on my newly created module. I checked and also don’t have any active Bootstrap Modules.

    How can I resolve this

    Reply
    • Nagaraju,
      It’s hard to say without seeing your code. I would expect that if you’re getting a 404 that the overriding mixin isn’t defined properly?
      Ryan

  3. Hi Ryan,

    Here is the code of overriding mixin

    define(“UsrCaseServiceUtilityV2”, [“CaseServiceUtility”],
    function() {
    Ext.define(“Terrasoft.UsrCaseServiceUtilityV2”, {
    override: “Terrasoft.CaseServiceUtility”,

    prepareCaseTermCalculatorConditions: function() {
    var conditions = [];
    this.addToConditions(conditions, “ServiceItem”);
    // FYI addToConditions method is defined in original “CaseServiceUtility”
    this.addToConditions(conditions, “ServicePact”);
    this.addToConditions(conditions, “Priority”);
    this.addToConditions(conditions, “Id”);
    this.addToConditions(conditions, “SolutionOverdue”);
    this.addToConditions(conditions, “UsrQueryType”);
    return conditions;
    }

    });
    });

    My Bootstrap Module

    define(“BootstrapModulesV2”, [“UsrCaseServiceUtilityV2”], function() {
    return {};
    });

    Reply
  4. I am also thinking of another method of creating a new mixin and applying it from case page. Also for that methods are triggered by Attributes when they changed like OnServiceChanged.

    “ServiceItem”: {
    “lookupListConfig”: {
    filter: function() {
    return this.getServiceItemFilter();
    }
    },
    “dependencies”: [
    {
    “columns”: [“ServiceItem”],
    “methodName”:”onServiceItemChanged”
    }
    ]
    },
    Can I able to override this attributes that are defined in higher packages and change the method name defined there, that will also work.

    Reply
    • Since CaseServiceUtility is a mixin on CasePage, you should be able to just place the override function for prepareCaseTermCalculatorConditions directly on CasePage with your own implementation. When the page calls the prepareCaseTermCalculatorConditions function it will be calling the override on the page rather than the version mixed into the page from the CaseServiceUtility mixin.

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!