How to apply different list filters based on navigation context (reference vs. direct access)?

Rosfield
Tera Contributor

Hi all,

I'm trying to conditionally filter a list view of the cmdb_ci_server table depending on how the user navigates to it.

‌‌Goal:
If the list is accessed directly via table navigation (e.g., cmdb_ci_server_list.do)
→ I want to apply a filter: manufacturer = VMware, Inc.

If the list is accessed via a reference field (e.g., u_server)
→ I want to show all records without any filter.

 

‌‌Question:
Is there any reliable way to distinguish whether a list view is opened from a reference field
or accessed directly via the table list view (e.g., cmdb_ci_server_list.do),
so I can conditionally apply the filter?

Alternatively, is there another recommended approach to apply different filters
based on how the list view was accessed?

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

@Rosfield 

you can do this

If the list is accessed directly via table navigation (e.g., cmdb_ci_server_list.do)
→ I want to apply a filter: manufacturer = VMware, Inc.

-> use Query business rule on that table and check the URL contains table_list and is not called via reference qualifier, if yes then apply filter for manufacturer

If the list is accessed via a reference field (e.g., u_server)
→ I want to show all records without any filter. -> apply reference qualifier and show all

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

VikMach
Mega Sage

@Rosfield, you can do this by editing the module for the respective class itself. (See snip below) Or modify the "All" servers module if you don't wish to load all servers without any filter.
Remember that if some one loads the table itself by typing "cmdb_ci_server.LIST" then system will load all the CIs from that Server class table. If you don't have any role condition in place then you can take following approach or else create different modules for different Server types.

VikMach_0-1754631136564.png


For applying role based filter you can add roles as well.

VikMach_1-1754631337244.png

 

 

Additionally if you wish to have more granular filtering condition with more advanced and complex conditions then do it from List Control. See snip below.

VikMach_2-1754631487011.png

 

 

Hope this helps.
Let me know if it worked.

Regards,

Vikas K

Rosfield
Tera Contributor

Hello, thank you for your feedback.

My customer is concerned about users directly accessing tables via the .list view.
They prefer not to expose all CI information by default.

However, they do want all CIs to be visible when selecting a CI from Incident or Change forms.
I hope you understand that filtering access through modules alone is not sufficient in this case.

Ankur Bawiskar
Tera Patron
Tera Patron

@Rosfield 

why not have different left nav modules for that and have fixed query applied to it using sysparm_fixed_query

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello, thank you for your feedback.

My customer is concerned about users directly accessing tables via the .list view.
They prefer not to expose all CI information by default.

However, they do want all CIs to be visible when selecting a CI from Incident or Change forms.
I hope you understand that filtering access through modules alone is not sufficient in this case.