The CreatorCon Call for Content is officially open! Get started here.

How to hide records from LIST view

shaik_irfan
Tera Guru

Hello Everyone,

we have a requiurement where i need to hide few records completely for which i written below BR Query script:

(function executeRule(current, previous /*null when async*/) {

// Add your code here

current.addQuery("u_field",'NOT LIKE' ,'%Network-Infra%');

})(current, previous);

List of records what i have in Table:

Network-ABA

Network-Operations

Network-Infra-Su

Network-Infra-Mu

Network-Infra-Ku

Network-Infra-Zoa

Network-Software

Network-Hardware

Network-Admin

I want to hide the recrods which starts from Network-Infra:

Network-Infra-Su

Network-Infra-Mu

Network-Infra-Ku

Network-Infra-Zoa

----------------------------

With above query i able to hide the fields, now my requirement is i want to add 1 record which should be visible:

Below is the record: Network-Infra-MM (This record should be visible how can i achieve this)

9 REPLIES 9

Chandu Telu
Tera Guru

Hi Irfan,




current.addQuery("u_field",'DOES NOT CONTAIN' ,'Network-Infra');



find_real_file.png




Please provide your feedback appropriately (Like, Helpful, Endorse AND/OR Correct) to help community.



Thanks


Chandu Telu


Chuck Tomasi
Tera Patron

Hi Shaik,



Try this instead...



current.addEncodedQuery('u_fieldNOTLIKENetwork-Infra');



I'm assuming u_field is a string or reference field



http://wiki.servicenow.com/index.php?title=Operators_Available_for_Filters_and_Queries#gsc.tab=0


Chuck,



Its a string field,



Below are the fileds:



Network-ABA


Network-Operations


Network-Infra-Su


Network-Infra-Mu


Network-Infra-Ku


Network-Infra-Zoa


Network-Software


Network-Hardware


Network-Admin


Network-Infra-MM



I want to hide all the fields which contain Network-Infra except Network-Infra-MM.



Hope you understand what i am trying to say


lks
ServiceNow Employee
ServiceNow Employee

Is it a generic requirement or for a specific user?