How to enable filter in the sp portals

servicenow lath
Tera Contributor

I have created a Widget for database view in the Sp portals , i need to enable the filter in the widget, how to do that?

0201a.jpg

on clicking the Ctrl+right click --> the instance option is not enabled,

how to make enable in the widget, any one suggest me with your ideas

3 REPLIES 3

Community Alums
Not applicable

Hi @servicenow lath ,

Data Table from URL definition widget

Data table from instance definition widget

Both "Data Table from URL definition widget" and "Data table from instance definition" embed the same widget "widget-data-table".

If you're using Data Table from Instance definition the filter has to be set in the widget instance options. You can make it work by passing 'enable_filter' as true. 

These Community conversations contain additional information:

 

SP22
Mega Sage
Mega Sage

Hi,
Please find the below link and let me know whether it is useful or not.
https://www.servicenow.com/community/developer-articles/adding-instance-options-to-directly-embedded...

Thanks
SP.

ajit kasabale
Tera Expert

Filters with a data table within the Service Portal

So this is my first share project, and I will be using this article to further explain the why's and how's for the project.

Why

We started using the CSM module, and the page used "csm_my_lists" is using a script which is read only. So you have no ability to change the "filters" as needed. Hence came the idea to use the filtering already provided by ServiceNow.

The filters shown are based on how you save the filter (visible to:)

  • Me = Personal Filters
  • Everyone = Global Filters
  • Group = Group Filter

How to use

  1. Simply create a new filter for example within the incident table, save this filter (me, group, public)
    ajitkasabale2_0-1672652668923.png

     


    Be sure to create "unique" names else the selection will highlight both of the selected filters.
  2. Create a menu link to the page (for example: /sp?id=filtered_data_table&table=incident)

    ajitkasabale2_1-1672652668938.png

     

  3. The saved filter will now appear on the page for the service portal users, based on the table used.

Example

This is the OOTB csm_my_lists

ajitkasabale2_2-1672652668944.png

 

This is the version I've created with the page: filtered_data_table

ajitkasabale2_3-1672652668958.png

 


And you can even change the titles (Global/Group/Personal)

ajitkasabale2_4-1672652668962.png

 


Now you can use the flexibility the filtering system ServiceNow offers to change it as needed.

Styling

You can change the page properties and CSS to fit your specific needs.
Example, fluid layout with table styling.

ajitkasabale2_5-1672652668976.png

 

Tips

Making a filter selected by default

Select the filter you want as a starting point copy the url, and change the current menu link with a selected filter:
Example: "/sp?id=filtered_data_table&table=incident&view=ess&sel=active_for_me"

Making only a certain public filter available

Simply add a new field within the filter table for instance a field called "Show on portal", select the filter you do like to share. Adjust the widget options encoded query with this new field: "u_show_on_portal=true";