How to add extra filtering to a pipeline
Glossary Item Box
To connect additional calculation filtering to a pipeline, you must implement the following sequence of actions.
The sequence of actions to change the calculations in a pipeline:
- Create a new class inherited from the calculation provider in which you want to implement the required filtering logic.
- Create a replacing FunnelChartSchema client schema and use a new calculation class in it.
Case description
You must add the "by number" filter to the sales pipeline calculation to select only those sales that have account in the [Client] field.
Case implementation algorithm
1. Create a new module in the custom package
Create a new calculation provider module in the custom package. The calculation provider is a class responsible for sampling, filtering and processing of the data for the pipeline chart.
Set UsrFunnelByCountDataProvider as the name and title for the generated module (Fig. 1).
Fig. 1. Calculation provider module properties
2. Define a new provider class and set the filter logic
To add the "by number" filter to the calculation, you need to 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 new calculation provider. Ext.define("Terrasoft.configuration.UsrFunnelByCountDataProvider", { // Inheriting provider 'Number of opportunities'. extend: "Terrasoft.FunnelByCountDataProvider", // New provider schort name. alternateClassName: "Terrasoft.UsrFunnelByCountDataProvider", // Expanding method of the base FunnelByCountDataProvider module. // gets filters for selection. getFunnelFixedFilters: function() { // Calling parent method. var esqFiltersGroup = this.callParent(arguments); // Adds a filter that specifies that an account is specified by the client in the opportunity. esqFiltersGroup.addItem( Terrasoft.createColumnIsNotNullFilter("Account")); return esqFiltersGroup; } }); });
Save the module.
3. Implement a module for the pipeline chart in the custom package.
To ensure that the new provider module is used in the calculations, you need to create a replacing client module and override the method of forming the sales pipeline calculation provider. First, we need to create a replacing client module, name it FunnelChartSchema and set it as the parent object. (Fig. 2).
Fig. 2. Replacing module properties.
You also need to add a new calculation module to the Dependencies section by specifying its name in the [Dependency] and [Title] as UsrFunnelByCountDataProvider (Fig. 4).
Fig. 3. Pipeline dependency schema properties
4. Specify the new calculation provider in the replacing pipeline schema
To do this, replace the calculation provider class in the replacing schema to a new one.
define("FunnelChartSchema", ["UsrFunnelByCountDataProvider"], function() { return { entitySchemaName: "Opportunity", methods: { getProvidersCollectionConfig: function() { // Calls the parent method that returns the providers array. var config = this.callParent(); // Searches for data provider for the "by number" filter. var byCount = Terrasoft.findItem(config, {tag: "byNumberConversion"}); // Replaces the new class. byCount.item.className = "Terrasoft.UsrFunnelByCountDataProvider"; return config; } } }; });
After the schema has been saved, the new pipeline calculation module will be used in the pipeline and will display only those opportunities that have account in the [Client] field.