- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 07:44 AM
Hi everyone, how are you?!
I want to hide a record from a related list when the state is "Pending"
I tried using a UI Policy:
Condition:
state is pending (print 1)
I also tried using the Script (print_3):
it is not to show the records when the state is "Pending".
Could anyone give me a tip or help me?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 08:35 AM
From what I know so far I don't think there is a way to hide a record in related list but either remove or filter it out.
If you want to remove it you will have to delete the record, you ca take a look at this link below:
However I can see the condition of removal is not triggered from the main table but the related list table itself, state changed to pending. For that I would suggest adding a filter in the related list itself and then setting it as default, however it can be easily removed from the breadcrumb by anyone which will remove the filter entirely.
If this response clears up your doubt, kindly flag it as both helpful and correct.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 08:39 AM - edited 11-03-2023 08:40 AM
A ui policy wont work, you have to create a server side script.
You can also change the default filter of the related list, This is also a good option. See this -> https://docs.servicenow.com/bundle/tokyo-platform-user-interface/page/use/using-forms/task/t_CreateA...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 08:11 AM - edited 11-03-2023 08:13 AM
Hi,
You can write a Query BR or READ ACL to check if this is a related list using scripted below
RP.isRelatedList()
Also make sure you check that the parent is is the table you want this to be on
eg
parent.getTableName() == 'incident'
And return false
Something like below
if(RP.isRelatedList() && parent.getTableName == 'incident')
answer = false;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 08:35 AM
Hi @Anurag Tripathi , how are you?!
I appreciate your suggestion, but it didn't work. I have this table (u_project_sa ) that is related to the Incident table, I need it to not be shown when the record is in the "Pending" state.
due to this I tried this script but it is not working:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 08:39 AM - edited 11-03-2023 08:40 AM
A ui policy wont work, you have to create a server side script.
You can also change the default filter of the related list, This is also a good option. See this -> https://docs.servicenow.com/bundle/tokyo-platform-user-interface/page/use/using-forms/task/t_CreateA...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 10:31 AM