Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Is it possible to lock slush bucket default filters in Related List?

pkottam
Kilo Contributor

Hello,

 

I have a related list on my Incident form. I have added a default filter in list control on that Related List. When I click on Edit.., a new window is opened with filter condition and slush bucket. Is it possible to lock the filter so that users cannot change the default filter and run it?

11 REPLIES 11

sayanbardhanroy
Kilo Contributor

Hi Pavan,



Do we have any solution to this ?



Thanks,


Sayan


Hi,


Skip the Client Scripts.



Create a copy of the global "Edit..." UI Action and include this line:


uri.set('sysparm_query', 'name!=NULL');



Just replace my example with an encoded query.



Simple as that



Full script example:


var uri = action.getGlideURI();


var path = uri.getFileFromPath();


uri.set('sysparm_m2m_ref', current.getTableName());


uri.set('sysparm_stack', 'no');


uri.set('sysparm_query', 'name!=NULL');


action.setRedirectURL(uri.toString('sys_m2m_template.do'));




We needed a custom UI-Action because of an issue when using a three way many-to-many relation. I added a default filter to hide the unnamed CI's which were topping the list on the go:
edit_ui_action.PNG