How to hide some fields from the table

shaik_irfan
Tera Guru

Hello Everyone,

We have a requirement where i need to hide some fields from Customized table since we do not Active checkbox option i think i need to write some script to hide the fields.

Can anyone please help me out how to achieve this   ?

List of field what i have is:

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 fields which starts from Network-Infra:

Network-Infra-Su

Network-Infra-Mu

Network-Infra-Ku

Network-Infra-Zoa

1 ACCEPTED SOLUTION

Please create Before Query Business Rule with below code, it should work.



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


// Add your code here


current.addQuery("<FIELD NAME WHICH HOLD THE VALUE>",'NOT LIKE' ,'%Network-Infra%');


})(current, previous);


View solution in original post

18 REPLIES 18

Shishir Srivast
Mega Sage

Hi Shaik,



You can use g_form.setDisplay() property to hide the field in onLoad() client script. Something like below should help.



function onLoad() {


    //Type appropriate comment here, and begin script below


g_form.setDisplay('field_name_of_Network-Infra-Su', false);


g_form.setDisplay('field_name_of_Network-Infra-Mu', false);


g_form.setDisplay('field_name_of_Network-Infra-Ku', false);


g_form.setDisplay('field_name_of_Network-Infra-Zoa', false);


   


}


Shishir,



Thanks for the reply, just a small doubt i explained wrong these are the list of records in a table


Hi Shaik,



If you want to hide a list of records, you may need to write a before query business rule.



Here is an example:



http://wiki.servicenow.com/index.php?title=Scripting_in_Business_Rules#An_Example_Script:_A_Default_...


Example script: default before-query business rule



You may want to customize it add logic that you want.



Hope this helps!



Thanks,


Neena