Question

Default filter for Section



Hello Community!

 

Earlier today I was looking for a way to filter records by default when a user enters a Section. For instance, if the user goes into Account, by default he'll see ONLY accounts that meet certain criteria. I know this is doable with advanced folders (by clicking on them) but is there a way to make it as easy as possible for the end user so they don't have to filter by folder but make it default instead?

 

Has anyone come across this same situation? Or perhaps know a workaround to my need?

 

Ignacio

Like 0

Like

2 comments

In order to implement the filter you need to create a replacing client module for the section. In that module you can override the getFilters method to add a filter to the filters collection. 

To create a filter use EntitySchemaQuery. 

Please find more information about filters in EntitySchemaQuery in the article below:

https://academy.bpmonline.com/documents/technic-sdk/7-13/working-entity…

Here is the example of  filtering records in the account section by the category field :

define("AccountSectionV2", [],

    function() {

    return {

        entitySchemaName: "Account",

        attributes: {},

        contextHelpId: "1001",

        messages: {},

        methods: {

                /**

                     *@inheritDoc Terrasoft.GridUtilitiesV2#getFilters

                     *@overriden

                     */

                    getFilters: function() {

                        var filters = this.callParent(arguments);

                        var category = "B";

                        filters.add("FilterCategory", this.Terrasoft.createColumnFilterWithParameter(

                                    this.Terrasoft.ComparisonType.EQUAL, "AccountCategory.Name", category));

                        return filters;

                    }

        },

        

        diff: /**SCHEMA_DIFF*/[    ]/**SCHEMA_DIFF*/

    };

});

Thanks Alina, this solved my issue!

Show all comments