How to Work with Filters and Orders

Standard Mode

Filters and orders allow users to set specific criteria that displayed cards should match and their sorting. In the Standard mode filters and orders are applied to all columns which have the same data source (for kanbans with only one data source - to all columns).

Filters and orders are set and applied separately for each column. They can be stored as Kanban views and selected to be applied together for the whole dashboard.

Also they can be stored as Filter Templates suitable for future re-use (see below).

On the Kanban click Filters button to open Filters sidebar.

Drawing

Configuring Filters

  • Select an Object in the proper picklist. Note: this picklist is shown only if there are columns with different Data Sources in the kanban and/or Custom Filters are configured. For kanbans with only one Data Source and without Custom Filters this picklist will be absent.

Drawing
  • Click "Add Filter" link in the "Filters" section header or the same button in the section (it is shown if no filters have been added yet)

  • Select a Filter Source (Object or Custom filter set for it):

Drawing

Source is a set of object fields allowed to select, and columns to apply these selections for. Source can be:

  • system - matches SObjects selected as data source for columns

  • custom - configured by dashboard administrator (see below)

After Source has been selected, you need to set a filter criterion.

  • Select a Field. An "Operator" picklist will appear; its content will depend on Field selected.

  • Select necessary operator and set the Value in the proper field.

  • Click "Add" button to add filter criterion to selected columns:

Drawing

User can add more filter criteria. Their amount will be shown in the header:

Drawing

If you add a filter which asks for some value, and this value is empty, these filters will be ignored. You should use "is null / is not null" operators to filter by empty values. System will show a hint about this, if you add a filter with empty value.

Drawing

Now user can:

  • Change filter criterion value (example: "Mechanical")

  • Edit filter criterion

  • Delete filter criterion

  • Clear all filters to show all records

  • Apply specified filters

  • Specify fliters logic (see below)

If add more than one filter criteria to the same column, user gets possibility to combine them with logic operators. The proper form will appear. Set the logic (place filter criteria numbers in brackets), e.g. {1} or {2}. By default all filters are applied with "AND" logic, i.e., each entry must match all filters.

Drawing

User also can add a sorting order to column views. Click "Add order" link or button (in orders section, if there are no orders added yet):

Drawing

An order form will be displayed. Select source (in the same way as for filters), and field and order type (ascending/descending). Click "Save" to add order to the view or "Cancel" to cancel.

Drawing

You can add more sorting orders to get items sorted by secondary (tertiary, etc.) fields. All orders will be displayed in "Orders" section:

Drawing

Advanced Mode

Advanced Mode enables individual filtering and sorting settings for each column separately. Toggle this mode on by clicking a proper toggler:

Drawing

In Advanced mode a column picklist is shown at the top of sidebar. User should select a column to filter it. After column is selected, user should select a Source, field, operator and value (in the same way as in Standard mode).

If some filters and orders were added in Standard mode, they will be added to each column with the same Data Source in Advanced mode.

Then user can sepcify which columns configured filter should be added to. An additional subsection is shown under the filter criterion form. Click it's header to expand and select other columns to apply filter to (note that column selected previously will be already checked there):

Drawing

Select columns with checkboxes and click "Save" to apply changes.

Filter will be shown in the sidebar. If filter is set to be applied not for all columns, proper information will be shown (mouseover a link to see which columns filter will be applied to):

Drawing

Manage Filters and Orders

User can save configured filters and orders for further usage as a View (see below).

Newly configured filters based on default "All Records" one can be saved as new Views only. Click menu button and select "Save as..." menu item:

Drawing

Enter new View name and click "Save":

Check "Save this view as a template for future use?" checkbox if you want to save selected filter/sorting as a Template (see below) instead of applicable View. In this case an optional "Template Description" field will be shown.

Drawing

New Filter will appear as a View at the Kanban Views Menu. Also it will be applied to the Kanban:

Drawing

Now user can:

  • select this View to apply a set of filter criteria and sorting order quickly

  • edit filters, orders and save this View or save as another view

  • make this View default

  • share this View (see below)

  • delete this View

Drawing

Sharing Views

Views can be shared using standard Salesforce sharing mechanism.

Click "share" button in Filter menu to open Sharing form page. Click "Add" button to create a new sharing. Select necessary users/roles/groups/etc. and click "Save":

Drawing

To share filter with multiple users you can create a public group, add users to this group and use it as a source record of new sharing setting.

How to mark filter as default for users programatically

Below script can be used to mark filter as default for the list of users.

String data = '{"defaultView":"filterName"}'; // JSON string, replace 'filterName' with a name of filter that needs to be set as default
String kanbanId = 'kanbanId'; // id of Kanban filter belongs to
List<User> users = [select Id, Name from User where Name = 'System Admin' or Name = 'Test User']; // select users filter will be shared with
List<FLX_KB__KanBan_Config_Custom__c> configToInsert = new List<FLX_KB__KanBan_Config_Custom__c>();
for(User u : users)
{
   configToInsert.add(new FLX_KB__KanBan_Config_Custom__c(FLX_KB__Assignee__c = u.id, FLX_KB__Data__c = data, FLX_KB__Source_ID__c = kanbanId, FLX_KB__Type__c = 'FiltersConfig'));
}
if(configToInsert.size() > 0) insert configToInsert;

Configure custom sources

Dashboard administrators can define their custom filter sources with restricted sets of fields. This can be useful in situations when it is not necessary to give user all object fields.

Open Kanban editor and click "edit" link next to "Config" label at the right sidebar and go to "Filters Configuration" tab. Click "+" button to add a filter:

Drawing

A popup will appear. On the "Basic configuration" subtab of it:

  • specify the filter source Label (that will be shown in the sources picklist on the Kanban)

  • set filter source Name

  • select Source Type

If the source type is SObject, a "Source Object" picklist will appear; select a source object. Available source objects are the same as were configured for the kanban columns.

Select Fields from the Source Object, that will be available for user to select in filters:

Drawing

Go to "Availability Configuration" subtab and select columns which this source will be applicable for:

Drawing

Save filter, filters configuration and kanban. Now when user opens filters and selects this custom source, he will be able to select fields and columns from restricted sets.

If the Source Type is Picklist or Static Text, administrator should configure some Apex properties. He should specify Title, select available Operators, choose Value and configure it:

Drawing

Availability configuration is configured in the same way as for SObject Source filters.

Transmitting Filters to Other Places

User can take filters currently applied to column(s) and pass them to other place where they are needed.

For example, we have a Kanban that shows Opportunities of some specific delivery/installation status in every column, and we want to show all entries related to each column in separate list. We do:

Create a form named "Opportunity form" with these elements:

  1. Variable of String type with this value: FORMULA[IF(ISBLANK({$FormParameters.filters}), '', ' and ' + {$FormParameters.filters})]

  2. List that has these properties:

    • Source Object: Opportunity

    • Conditions: DeliveryInstallationStatus__c = '{$FormParameters.dis}' {$Form.$Variables.filters}

  3. Add some static text which will contain {$Form.$Variables.filters} text - this will allow to see filter criteria actually passed to the form.

Create standard kanban, add 3 columns there. Columns should have these properties:

  • Data Source: Opportunity

  • Conditions: Delivery/Installation Status equals "In progress" / "Yet to begin" / "Completed" (different for each column)

Add a cell in each column header, with these properties:

  • Type: Text

  • Value: {$Column.Name}

  • Handler with these properties:

    • Type: Form

    • Value: Opportunity form

    • Open in: New Window

    • Parameters:

      • filters= {$Column.Filters}

      • dis = "In progress" / "Yet to begin" / "Completed" (different for each column)

      • mode = edit

Add a card to represent opportunities (with name, Delivery/Installation Status and Stage fields).

Drawing

Save and open the newly created kanban. Click on Filters sidebar and set some filters and filter logic. Apply the filtering set.

Click on the header of the column which is affected by these filters. Form will be opened in the new tab and will show the full list of opportunities matching these criteria:

  • Delivery/Installation Status is equal to form handler parameter "dis"

  • Stage is matching the filters set (StageName = "Closed Won" OR StageName = "Qualification") - that was the purpose of this example:

Last updated