Programmatically Overriding or Adding Filters to a Section List in Creatio

In a section in Creatio, the data displayed in the list is based on the filters selected or added by the user. However, what if you always want to filter out certain types of records. For example, what if you want data that meets some condition to never display (or always display)? In the section code, you can retrieve the filters set for the section and completely replace them, or just add some additional conditions to them. This applies if the section doesn’t have any filters set, you can still set or add your own.

The section has a function you can override called getFilters. This function retrieves all the conditions set for the section list, which can include folders with conditions as well as the quick filters at the top of the section. If we override this function, we can get the filters set for the list and then replace them or add additional filters. In this case, we’ll always filter out records that have a boolean column “UsrFlagged” set as true.

To accomplish this we’ll add the following in the section schema methods:

getFilters: function() {
    // get the filters set for the section from the parent function
    var filters = this.callParent(arguments);

    // now add our filter
    filters.add("FilterType", this.Terrasoft.createColumnFilterWithParameter(
      Terrasoft.ComparisonType.EQUAL, "UsrFlagged", false));

    // now return the filters so they are applied to the list
    return filters;
}

That will now be a filter *always* for the section, regardless of what the user sets or what the folder conditions are. You can make this more useful by even conditionally restricting the records in the section based on a user or role.

Want content like this delivered to your inbox? Sign up for our newsletter!
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.

Submit a Comment

Your email address will not be published. Required fields are marked *