Hide new button of related list based on count
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2024 05:35 AM
i have a requirement to hide a new button of related list(outage). onnincident record's related list if we have one outage then new button should be hidden.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2024 06:06 AM - edited ‎10-31-2024 06:07 AM
You should be able to do this as follows:
1. Right-click on any column heading on your Related list and Configure=>List control=>Omit New button
2. Check Omit New checkbox
2. Write your script in the Omit New condition Script field (if not on your form configure the form to show it)
If you have never done this before this video is a decent walkthrough of the process: https://www.servicenow.com/community/developer-blog/how-to-hide-new-button-from-related-lists-using-...
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2024 06:07 AM
Hi,
Try this in Omit New Button
Right click on the list header -> Configure -> list Control
var answer;
if(current.getRowCount() > 0) {
answer = true;
}
else {
answer = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2024 06:10 AM
HI Anurag,
thanks for quick reply. this works fine for native ui. i want to hide new button form related list which is present in service operation workspace.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2024 06:13 AM - edited ‎10-31-2024 06:14 AM
Check my reply here -> Solved: How to hide New Button from a related list in the ... - ServiceNow Community
Im not sure if there is a way to put condition there or not.