
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 09:00 AM
Hi Community,
I need to apply a default filter on a related list which I managed to do (used the Set as default filter option from
Solved: How to set Default Filter on related list for all ... - ServiceNow Community ), however I have the requirement to "lock" this filter so it cannot be removed by users, but allow them to keep on building the filter if they want to.
I've tried various combinations from List Layout control such as omit filter or restrict the filter by roles, but in most cases I only manage to make the filter icon unavailable.
Is this possible at all?
Thank you.
Paula
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 05:51 AM
This will re-create the out of box filter:
current.addEncodedQuery('top_task=' + parent.sys_id);
so it looks like the full one would be:
current.addEncodedQuery('top_task=' + parent.sys_id + '^u_dependency_typeINinternal,external,3rd_party,other');
'parent' here refers to the pm_project table record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 09:27 AM
Hi Paula,
Consider the approach of re-creating the Related List by creating a Relationship with the same Applies to and Queries from tables. The script would link to the parent record, then add whatever is in your default filter. You would then show this Related List on the form instead of the out of box one.
In the scenario of the Incident Tasks Related List on the incident form that only filters on incident = <<current record>> let's say I want to also only show active tasks. The Relationship looks like this:
You can use the same Name as the existing Related List, or whatever you want to show on the tab. When users manually alter the filter on this custom Related List, they won't see the existing criteria, but can add to it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 10:05 AM - edited 01-08-2025 10:07 AM
Hi @Brad Bowman many thanks for the suggestion. I've tried to implement it but I'm stuck with applying the filter correctly, this is as far as I got
(function refineQuery(current, top_task) {
// Add your code here, such as current.addQuery(field, value);
current.addEncodedQuery('pm_project=' + top_task.sys_id + '^u_dependency_type="other"')
})(current, top_task);
I've tried a few combinations to replicate this query of how the filter is applied on the list of records:
top_task=a847846c1bfd5654b436a86fe54bcb72^u_dependency_typeINinternal,external,3rd_party,other
Any ideas how I can correct the above? So far the related list returns all Project Task records from the system. I only got as far as to filter the active ones as I tried your example first.
Thank you.
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 10:29 AM
Which out of box Related List on which form are you re-creating?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 04:41 AM
Project Task related list which sits on the Project -> pm_project_task.top_task