Enable additional filtering in a sales pipeline
In Creatio, you can enable additional filtering for calculations in sales pipeline charts.
To do it this:
- Create a new class inherited from the calculation provider and implement the necessary filtering logic.
- Create a replacing FunnelChartSchema client schema and use the new calculation class in it.
Case description
Add filtering to sales pipeline calculations displayed in the “Number of opportunities” view for selecting the opportunities whose Customer field is populated with an account.
Source code
You can download the package with case implementation using the following link.
Case implementation algorithm
1. Creating a new module in the custom package
Create a new calculation provider client module in the custom package. Calculation provider is a class responsible for selecting, filtering and processing data for sales pipeline chart.
Specify a name and caption for the new module, for example, UsrFunnelByCountDataProvider
(fig. 1).
2. Defining the new provider class and specifying the filtering logic
Inherit the created class from the FunnelByCountDataProvider
class and override the getFunnelFixedFilters
method.
define("UsrFunnelByCountDataProvider", ["ext-base", "terrasoft", "UsrFunnelByCountDataProviderResources", "FunnelByCountDataProvider"], function(Ext, Terrasoft, resources) {
// Defining the new calculation provider.
Ext.define("Terrasoft.configuration.UsrFunnelByCountDataProvider", {
// Inheritance from the provider "by number".
extend: "Terrasoft.FunnelByCountDataProvider",
// Contracted name of the new provider.
alternateClassName: "Terrasoft.UsrFunnelByCountDataProvider",
// Extending the FunnelByCountDataProvider base module method.
// Returns filter for selection.
getFunnelFixedFilters: function() {
// Calling the parent method.
var esqFiltersGroup = this.callParent(arguments);
// Adds filter specifying that the customer of an opportunity is an account.
esqFiltersGroup.addItem(
Terrasoft.createColumnIsNotNullFilter("Account"));
return esqFiltersGroup;
}
});
});
Save the module.
3. Implementing the pipeline chart module in custom package
To use the new provider module in calculations, cerate a replacing client module and specify FunnelChartSchema
from the Opportunity
package as a parent schema (fig. 2).
4. Specify the new calculation provider in the sales pipeline replacing schema
Override the provider generator method of sales pipeline calculation in the replacing schema and specify the new provider class for calculations.
define("FunnelChartSchema", ["UsrFunnelByCountDataProvider"], function() {
return {
entitySchemaName: "Opportunity",
methods: {
getProvidersCollectionConfig: function() {
// Calls parent method returning the provider array.
var config = this.callParent();
// Searches for data provider for displaying in the “Number of opportunities” view.
var byCount = Terrasoft.findItem(config, {tag: "byNumberConversion"});
// Changes for a new class.
byCount.item.className = "Terrasoft.UsrFunnelByCountDataProvider";
return config;
}
}
};
});
After you save the schema, the new calculation module will be used in the sales pipeline. It will display the opportunities whose Customer field is populated with an account.