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,





Can you please help me out with the Script ?


Prabhat4
Tera Contributor

Hi Shaik,



I'm Assuming that in your requirement your asking about making changes in table dictionary view and not on form level.


So, If you want to hide few fields from your custom table then you have to do following thing in order to achieve your requirement.


        1. Set the current scope to your custom application or scope == under the scope table is developed.


        2. click on gear icon(personalize) then take the "Read Roles" to selected section.


        3. You should be able to see whether any read roles has been defined for particular field or not.


        4. Click on table field you want to hide then set read roles to "Admin only", post that these fields will be only visible to admins.


        5. check and validate by impersonation of some ITIL user.


I'm attaching 2 screenshots for your reference, i hope this will suffice your requirement. or else if you wan to hide these fields on form level then you can simply refer to below links



UI POLICY --> http://wiki.servicenow.com/index.php?title=Creating_a_UI_Policy#gsc.tab=0


CLIENT SCRIPT--> http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#gsc.tab=0



find_real_file.png


find_real_file.png


Thanks


Prabhat


Thanks Prabhat,



But my actual requirement is to hide some records for all the users


Harsh Vardhan
Giga Patron

write query business rule on that table. just think like based on some glide query results come out.


so same way you need to write Query business rule on that table and once that br will execute records will be visible.



or another way is ACL . create script in acl based on users role or group members it will show the output in list.


Harshvardhan,



We dont have an access to ACL so we need to go with BR.



Could you please help me out with the script if possible ?



I want to hide it completely since we are not using that request anymore, we can delete it but the problem is if we want to use the service in future we can just deactive the script and all the records will be available again, so thats the reason we want to hide list of records instead of deleting it.



As it is a Cutomized table we dont have Active checkbox option, it would be more helpful if you can help me out with BR script:



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