
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2018 04:45 AM
I have a requirement to show/hide a catalog item based on a custom field in the catalog item definition. Is something like $current available to be used in user criteria scripts? Seems the whole user criteria system is designed to go look elsewhere (like the user record) and return a true/false w/o regard for where the user criteria is being applied to.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 04:37 AM
UPDATE: My findings after a few days of research.
1. Using user criteria, there is no way to pass a dynamic variable/object like $current. As a workaround you will have to create user criteria specific to the file it is associated with (a catalog item in this case) and hardcode a sys_id of the record you need info from in order for your script/script include to do a lookup on.
2. It appears you can pass pass a $current object to the older entitlement scripts HOWEVER entitlement scripts do not run IF you have user criteria turned on in the Service Catalog properties.
I didn't want to take away the ability to use user criteria for my entire service catalog(s) so I opted for option #1...which means lots of user criteria. I'm using a script include to do most of the logic as to reuse as much code as possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2018 10:57 AM
Hi Craig,
I don't think that it is possible. But without deeper knowledge of you requirements and customization I would say skip the custom field and create it in user Criterias instead. If you could provide some more info about the requirements it would be easier to help out and try to come up with an solution.
//Göran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2018 12:28 PM
Here is an example that doesn't require any custom fields but it does require the script (be it a user criteria or an entitlement). We want to only show catalog items associated with catalog items associated with compatible models to the asset(s) assigned to the logged in user. I'm using the model field in the catalog item record to store the associated model, I need to be able to tell the user criteria that model somehow. If I could pass in a sys_id from the catalog item...I can do this. But user criteria seem to be designed to go look elsewhere for something and are agnostic in terms of what is calling them (be it a catalog item, knowledge base, or whatever).
As it stands right now I'm going to have to build out a user criteria for each catalog item we want this to apply to and pass in a hard coded value. Yuck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 01:21 AM
Hmm.. that is a tough one that needs some thinking how to solve that the best way. I guess you could skip the User critiera and do ACLs instead, but that isn't really the most optimal way.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 04:37 AM
UPDATE: My findings after a few days of research.
1. Using user criteria, there is no way to pass a dynamic variable/object like $current. As a workaround you will have to create user criteria specific to the file it is associated with (a catalog item in this case) and hardcode a sys_id of the record you need info from in order for your script/script include to do a lookup on.
2. It appears you can pass pass a $current object to the older entitlement scripts HOWEVER entitlement scripts do not run IF you have user criteria turned on in the Service Catalog properties.
I didn't want to take away the ability to use user criteria for my entire service catalog(s) so I opted for option #1...which means lots of user criteria. I'm using a script include to do most of the logic as to reuse as much code as possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2021 12:54 AM
User Criteria has nothing to do with Catalog Item security. It's the other way. Catalog Item uses User Criteria to group users for its security. So, User Criteria Script will not have access to Catalog Item.
Please refer to the deep dive blog on user criteria.
There is no good solution for your usecase, hence I would suggest to put this in the Idea portal so that it can be considered as a feature for the Catalog Product.