- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
Good evening.!
On the sc_task table, under "Approver" section, we have "Edit" button.
Issue is, once you click on the button, the list search is showing both active and inactive users.
My requirement is to only show active users. How can we achieve it? Please help.
We can use the below filter, but it will apply manually, not automatically.
@Ankur Bawiskar @Dr Atul G- LNG @Viraj Hudlikar
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
HiI @AbdurRahmanSnow
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
Working Approach
-> Configure List Control by Right Click on Related List Header and Add Default filter Active=True
-> Even if you add that Default filter, users can still remove that and select Inactive users
-> to handle this create a UI script and use DOM manipulation to remove that filter
addLoadEvent(hideButtonsAdd);
function hideButtonsAdd() {
if (document.URL.indexOf('sys_target=sysapproval_approver') != -1 && document.URL.indexOf('sysparm_referring_url') != -1) {
gel("_add").disabled = true; // hide the add filter button
gel("_run").disabled = true; // hide the run filter button
// give some timeout to run the default filter and then hide that
setTimeout(function() {
document.getElementsByClassName('filter_row_condition')[0].style.display = 'none'; // hide the filter
}, 1000);
}
}
Output: Filter is applied and users can't run the filter as it's hidden, hence inactive users can't be selected
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
HiI @AbdurRahmanSnow
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
Thank you so much, Sir. It worked. Amazing, shortcut method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
that's OOTB behavior
Approach: Override the Edit button for your approval table and then specify the filter to show only active users
this link has approach from me, check and enhance for your requirement
How to hide Display filter after clicking edit button in related list
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
Working Approach
-> Configure List Control by Right Click on Related List Header and Add Default filter Active=True
-> Even if you add that Default filter, users can still remove that and select Inactive users
-> to handle this create a UI script and use DOM manipulation to remove that filter
addLoadEvent(hideButtonsAdd);
function hideButtonsAdd() {
if (document.URL.indexOf('sys_target=sysapproval_approver') != -1 && document.URL.indexOf('sysparm_referring_url') != -1) {
gel("_add").disabled = true; // hide the add filter button
gel("_run").disabled = true; // hide the run filter button
// give some timeout to run the default filter and then hide that
setTimeout(function() {
document.getElementsByClassName('filter_row_condition')[0].style.display = 'none'; // hide the filter
}, 1000);
}
}
Output: Filter is applied and users can't run the filter as it's hidden, hence inactive users can't be selected
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
