use of the canView() function

randrews
Tera Guru

I am unable to find any documentation on the canView() function in ServiceNow...

i know that in a background script for example i can use rec.canView()   to evaluate if the person at the keyboard can view a catalog item.... but does it work for other record classes.. and can i pass any information into the canView() function... for example the ability to pass in a user sid would be GREAT to be able to evaluate if someone else can view things.. this way we can write scripts in the background script module.. test them completely and THEN move them to where they belong.

has anyone seen ANY documentation of the canView() function? i checked all of the scripts on my system and the only time i find it it doesn't pass in any parameters.

6 REPLIES 6

Chuck Tomasi
Tera Patron

I don't see it documented on developer.servicenow.com which makes me think it is deprecated. I'm interested to see if anyone of our developers have further information on it.


Hi Chuck,

Did you get any further information on this?

I have a requirement to hide Catalog Items/Categories in the back-end based on whether or not the Item/Category is available for said user.

Best,

Mark

ps if you wanted more info on the requirement then read on - otherwise don't worry about this bit:

Category A and Item A are not available for User A who has an itil license.

User A cannot request these in the Service Portal, however in the back end if viewing sc_category_list.do can see the Category. They can then click into the Category, see information about it and Click into the related Items. They could click into Item A and see all the details of this Catalog Item also.

We want to prevent that.

To prevent someone from seeing an item in the list, use an ACL. User Criteria applies to whether or not they can see it in the catalog, not a standard list. 

Docs: Access control rules

Docs: Contextual security  

 

Hi Chuck,

I plan to do so but would like to base the ACL on whether or not the current user can see the Item in the Catalog.

Do you know if canView() is depreciated as you suspected? If so is there some other method I should be using?

Thanks,

Mark