- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 07:11 AM
Hi,
Greetings for the day!
I have a requirement to update the related list filter on User table.
On user form we have "Incident>Opened_by" related list with filter as Opened by is the user (User's whose form we are viewing). We want the filter as Opened by or Incident's Caller is the user (User's whose form we are viewing).
Please assist here, Thanks in advance!
Regards
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 08:59 AM
In this case it is best to create a new custom Related List. If you're not familiar, do this via System Definition > Relationships in the left nav. Create a new record that looks something like this:
With the Name being whatever you want to appear on the Related List tab. Here is the Query with script:
function refineQuery(current, parent) {
current.addEncodedQuery('opened_by=' + parent.sys_id + '^ORcaller_id=' + parent.sys_id);
})(current, parent);
Add this Related List to your User form, then you can change the column layout like any other list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 08:59 AM
In this case it is best to create a new custom Related List. If you're not familiar, do this via System Definition > Relationships in the left nav. Create a new record that looks something like this:
With the Name being whatever you want to appear on the Related List tab. Here is the Query with script:
function refineQuery(current, parent) {
current.addEncodedQuery('opened_by=' + parent.sys_id + '^ORcaller_id=' + parent.sys_id);
})(current, parent);
Add this Related List to your User form, then you can change the column layout like any other list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 10:13 PM
Thanks Brad, it worked as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 09:03 AM - edited 06-03-2024 09:03 AM
@Ridhima_1 You can modify the default filter of a related list by right clicking on one of the column headers / field names in the related list > Configure > List Control in the List Control form if the Edit default filter field is not present right click on the form header > Configure > Form Layout and add the Edit default filter field as a selected field.
Reference link : https://www.servicenow.com/community/developer-forum/how-do-you-set-the-default-filter-for-a-related...
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.