Add fixed filter to detail

Hello community,

 

I have a detail DocListInFinApp in Application Page and I want to add a fixed filter to the detail based on application current stage. Is there a way to add a fixed filter to the detail to only show specific documents.

 

I have implemented the following code to test the functionality

methods: {
			onEntityInitialized: function() {
 
				this.callParent(arguments);
                this.initFixedFiltersConfig();
			},
			// Initializes the fixed filters.
            initFixedFiltersConfig: function() {
                // Creating a Configuration Object.
                var fixedFilterConfig = {
                    // The schema of the section object is specified as an object schema for fixed filters. 
                    entitySchema: "DocListInFinApp",
                    // Array of filters.
                    filters: [
                        // Owner filter.
                        {
                            // The name of the filter.
                            name: "StageFilter",
                            // Filter header.
                            caption: "StageFilter",
                            // Filter the data from the [Owner] column.
                            columnName: "DocumentListStage",
                            // Current user contact is specified as default value.
                            // Value is received from the system setting.
                            defValue:"69CF135A-9D15-4500-A0D1-E553A7BD5620",
                            // The data type – lookup.
                            dataValueType: this.Terrasoft.DataValueType.LOOKUP,
                            // Filter.
                            filter: BaseFiltersGenerateModule.StageFilter
                        }
                    ]
                };
                // A link to the configurational object is assigned to the [FixedFilterConfig] column.
                this.set("FixedFilterConfig", fixedFilterConfig);
            }
		}

 

Like 0

Like

2 comments

Hello User1997,

 

There is no way to add the fixed filter in the detail using FixedFilterConfig, but you can add additional filtration to the detail records using the following example:

//details object
"Schema386de87bDetailfb4e174c": {
				"schemaName": "Schema386de87bDetail",
				"entitySchemaName": "Document",
				"filter": {
					"detailColumn": "UsrCase",
					"masterColumn": "Id"
				},
				"filterMethod": "CaseStatusFilter"
			}
...
//methods object
CaseStatusFilter: function() {
						var filterGroup = new this.Terrasoft.createFilterGroup();
						filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.AND;
						filterGroup.add("ByCaseStatusFilter", this.Terrasoft.createColumnFilterWithParameter(
							this.Terrasoft.ComparisonType.EQUAL, "UsrAvailableCaseStatus", this.get("Status"))
						);
						return filterGroup;
					},

Such a filtration is used for example to list only email activities in the "Email" detail in the contact or account page. The logic is simple: add additional filtration to the already present detail filter. In the case above:

 

1) There was a lookup column added to the Documents object. The lookup column relates to Cases object.

2) There was another lookup column added to the Documents object. The lookup column relates to CaseStatus object.

3) The detail is created on the CasePage to list those documents that are connected to the case (Case column of the Document object is the same as the current case record opened. The detail object is also Document)

 4) Add additional filtration in the "filterMethod": "CaseStatusFilter" part to return only those documents that have the same value in the "UsrAvailableCaseStatus" lookup column (from step 2) as the current case status.

 

Hope this will fit your business logic.

 

Best regards,

Oscar

Oscar Dylan,

Thanks Oscar, 

The problem with this solution is that the filter must be visible to the user. Is there any way we can make the applied filter visible?

Show all comments