Hide/show record as per roles

arohi
Kilo Expert

I want to hide records who have a specific type( type is field on form) if it is sla then it should be visible only for those users who have a role as sla.

Tried with some acls. now record info is not visible but the 'i' icon is still there and if user clicks that, it redirects to form. it looks like as below:

find_real_file.png

So in case it is not possible to hide record, atleast after clicking this I icon it should redirect to form only if a user with sla role clicks it. else it shouldn't work for othrt users.

Please suggest how to achieve this.

Thanks in advance

9 REPLIES 9

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Arohi,



Goran is correct here. Please refer below link for server side code.


Getting a User Object - ServiceNow Wiki


Hey Pradeep,


I am trying to do it with brule 'before-query'


find_real_file.png


find_real_file.png


Here in this script as in 'type' field is reference field and may be that is not correct way to compare value of reference field in script, its not working. Can you tell me this way can I achieve. pls suggest


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

it should be type.name instead of type in addQuery. Here I am assuming reference record which holds the value has a column name.


What you can do if you think the query is tough. Go to the list view, make the filter there as you want. Right click and choose copy query.



Then you can use addEncodedQuery(INPUT_QUERY); instead



Can read about it here:


https://wiki.servicenow.com/?title=GlideRecord#gsc.tab=0



//Göran


Aravind3
Tera Contributor

Hi,

 

Even I have the same kind of requirement...Can you help me how to achieve this!!!