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

Its a generic requirement


dravvyramlochun
ServiceNow Employee
ServiceNow Employee

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Irfan,



your onQuery business rule is hiding that record as well since it starts with "Network-Infra" so why not update your business rule to include an array of values you need to hide.


this solution is recommended if less values are to be hidden through business rule i.e. array has less elements.


Example: consider you want records to be hidden for 4 values of 'u_field' then you can create an array with 4 elements. if in future need arises you can just add an element in the array and that should work.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


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

ANkur,



I thought the same since i have more than 50 records which i hided later today we got a request to new role with similar name which should be visible


Mohit Sharma1
Kilo Contributor

Hi,

Using Global Hide Manager You can easily hide (Edit, List, Detail View) fields as well as there value in any record. you can also Encrypt fields from left to right/right to left i.e. ****25 8954