Getting the current Cat Item in a User Criteria Script

ron_tavares
ServiceNow Employee
ServiceNow Employee

Is it possible to pull in the current Catalog Item in the advanced script of a User Criteria?   Why do I want to do that?   The customer has a requirement to be able to block certain users from certain Catalog Items for a period of time.   For example, John Smith is restricted from accessing the New Laptop Request until the end of August.   My thought is to create a custom "Request Blocking" table with three fields:

1) User: Reference to sys_user

2) Cat Item: Reference to sc_cat_item

3) Block End Date: Date field

Then create a User Criteria that would be added to all the Cat Items.   The Script would need to search the custom table for match on the following:

1) user = Current user

2) cat_item = The Cat Item that the User is trying to access

3) block_end_date > today

If it finds a match, it returns an answer of false, (meaning access denied).   Ff no match found, return true.

#1 & 3 are easy, but can't figure out how to pull in the Cat Item for #2, or if this is even possible.

Any thoughts?

Thanks,

.ron

5 REPLIES 5

thank you for the response Ron.