How to show only active users on the "Edit" button under sysapproval_approver table ?

AbdurRahmanSnow
Tera Guru

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. 

AbdurRahmanSnow_1-1770729050916.png

We can use the below filter, but it will apply manually, not automatically.

AbdurRahmanSnow_2-1770729099638.png

@Ankur Bawiskar @Dr Atul G- LNG @Viraj Hudlikar 

Thank you.

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron

HiI @AbdurRahmanSnow 

https://www.servicenow.com/community/itsm-forum/creating-a-filter-for-edit-members-page/td-p/875098/...

https://www.servicenow.com/community/itsm-forum/how-can-i-apply-a-filter-to-edit-members-form-for-af...

 

https://www.servicenow.com/community/servicenow-ai-platform-forum/default-filter-for-edit-members-sc...

 

*************************************************************************************************************
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]

****************************************************************************************************************

View solution in original post

Ankur Bawiskar
Tera Patron

@AbdurRahmanSnow 

Working Approach

-> Configure List Control by Right Click on Related List Header and Add Default filter Active=True

AnkurBawiskar_0-1770730594890.pngAnkurBawiskar_1-1770730612608.png

-> 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);

    }
}

AnkurBawiskar_4-1770731639767.png

 

Output: Filter is applied and users can't run the filter as it's hidden, hence inactive users can't be selected

hide inactive users from related list of approvers.gif

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Thank you so much. It worked. Amazing, shortcut method. 

AbdurRahmanSnow_0-1770743108124.png

AbdurRahmanSnow_1-1770743137797.png