hide row in a table list

Brian Lancaster
Tera Sage

We are working on making it so that all users can see the application in the CMDB in a List just like if you went to configuration > Applications for ITIL users.   I have been asked if there is a way to hide an application from the list view if IT Owner (one of the fields) is empty.   Does anybody know if this is possible and how I could go about doing it?

11 REPLIES 11

kristenankeny
Tera Guru

I would suggest updating the ACLs so that you have two read rules: If ITIL, allow read. Then have one without a role associated with it and script the ACL to check the IT Owner field.


Alikutty A
Tera Sage

Hi,



You need to write a before query business rule on the required table to achieve this requirement.


if (gs.getSession().isInteractive()) {


if(gs.hasRole('itil')){


current.addQuery('it_owner', '!=', '');


}


}




Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Brian,



You can create a BEFORE query business rule to restrict record access to certain rows as per your req.


https://www.servicenowguru.com/scripting/business-rules-scripting/controlling-record-access-before-q...


darius_koohmare
ServiceNow Employee
ServiceNow Employee

Do you want to hide it for just non itil users?


A business query rule can do the trick.



Set the condition of the query to return true if the user does not have the itil role



In the script, add



var qc = current.addQuery("YOURITOWNERFIELD=NULL


")



to then add a query filtering out records where the it owner is empty.