In workspace, how to filter List Record with filter

Li QingWen
Tera Contributor

Dear All, In workspace, how to filter List Record with filter? The filter I created can filter other reports, but it cannot filter List. Is there any problem with my setting. thank you!

2 REPLIES 2

Not applicable

Hi @Li QingWen ,

In a ServiceNow Workspace, you can filter a List Record using predefined conditions or by applying filters programmatically. Below are the ways to accomplish this:

Use Workspace UI

  1. Open the Workspace:

    • Navigate to the workspace where the list view resides.
  2. Apply Filters:

    • Click on the filter icon or use the filter bar at the top of the list.
    • Define your conditions (e.g., State is Closed or Priority is High).
    • Save or apply the filter.

Use glideList API for Advanced Filters

In case of dynamic filtering based on user interactions:

  1. Update Workspace UI Action or Script: Use GlideRecord or REST API to filter records dynamically.

  2. Example Script for a Filter:

    javascript
    Copy code
    var gr = new GlideRecord('incident'); gr.addQuery('priority', '1'); // Example: Filter by high priority gr.addQuery('state', '!=', '6'); // Example: Exclude resolved state gr.query(); while (gr.next()) { gs.print(gr.number); }

Use Query Parameters for Filters

If using URL-based navigation:

  1. Construct the URL for the list view:
    bash
    Copy code
    /now/workspace/your_workspace/list/your_table?sysparm_query=priority=1^state!=6
  2. Replace your_workspace and your_table with the workspace and table names.

vishwajeet5550
Mega Guru

In Workspace, if you're trying to filter a List of records you need to ensure that the list view is configured to support filtering For Lists in the Workspace, the List Layout must be properly configured to allow filtering via the Filter widget or Filter Criteria.

Ensure that:Filter conditions are defined for the list

The list is not using Filter Out of Box settings, which might prevent custom filters from applying.

To filter records in a List inside a workspace, you generally have two ways: 

Filter Widget in Workspace: In the workspace, the Filter Widget might be used for filtering the list of records.

If you’re using a List View or Table Widget in your workspace, ensure that you’re interacting with the correct filter field and are applying the filter correctly. You can typically add fields such as status, priority, assigned to, etc., in the filter UI.

You may need to check if the filter you created is correctly linked to the records you want to filter.

Global Filters If you created a filter globally (for example, a report filter), make sure you are using the right context in the List. Filters in reports (like those applied to reports on dashboards) can often be linked to the list records, but you need to ensure that:

The filter applies to the same table you are filtering in the List.

The conditions in the filter match the data types in the list

If the filter works for reports but not for Lists, there might be a few reasons:

-Table Mismatch: Ensure that the filter you're using is applied to the right table (e.g., incident table for Incident list).

-List Widget Configuration: The list you're trying to filter may not be associated with the correct List Widget or List Control. Check the widget's configuration, especially the conditions or criteria.

-Field Availability: Verify that the fields being filtered by the filter are available in the list you want to filter. If a field is not included in the list, the filter might not apply to it.

-Permissions: Check if the user has the appropriate permissions to view or filter the records. Sometimes, filters may not work if there are access control policies or user roles preventing filtering on certain records.

 

-Go to System UI  Filters and verify the filter criteria and the table it’s applied to.

 -If needed, create a new filter with specific criteria for the List records.

 

 

-Go to Workspace  Agent Workspace or the specific workspace configuration.

-Review the List Widget or Table Widget settings. Ensure it's set up to accept the filter.

-Use the Correct Context

-If using a report filter, confirm that the same filter conditions are available when you are filtering records on the list in Workspace. Sometimes, reports are based on different table or filter conditions than the list you are working with.

 

-Sometimes, UI policies or UI actions can impact the visibility of records in the list and prevent the filter from applying. Ensure there are no conflicts.