- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2016 10:45 AM
We're using the Service Desk Call application (Geneva), and the problem is that when the Call type is "Request", the entries under the "Request item" aren't filtered based off User Criteria. I'm fine scripting the filtering out, but there are no references for this in Service Catalog. I can model some things around the calls Knowledge v3 makes, but that falls short. Anyone have any information around scripting for User Criteria checks?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2016 06:12 AM
Hi Damian,
The user criteria is really meant to determine whether the logged in users will see specific items and categories while browsing or searching the service catalog. If you want a head start on writing a script that does it I would take a look in the ui page com.glideapp.servicecatalog_cat_item_view.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2016 06:12 AM
Hi Damian,
The user criteria is really meant to determine whether the logged in users will see specific items and categories while browsing or searching the service catalog. If you want a head start on writing a script that does it I would take a look in the ui page com.glideapp.servicecatalog_cat_item_view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2016 06:54 AM
Brad,
That was perfect! I was able to take the UI Page and code up a dynamic reference qualifier to only show available Catalog items. Thanks again!
var ReferenceUtilities = Class.create();
ReferenceUtilities.prototype = {
initialize: function() {
},
filterRequestItems: function() {
//Start with a blank list
var availableItems = ' ';
//Get all active Catalog items
var catItem = new GlideRecord('sc_cat_item');
catItem.addActiveQuery();
catItem.query();
//For each Catalog item
while ( catItem.next() ) {
var item = GlideappCatalogItem.get(catItem.sys_id);
//If it's an actual item, and the current user can access it, add it to the CSV of sys_ids
if (item != null && item.canView()) {
if ( availableItems.trim().length == 0 ) {
availableItems = catItem.sys_id;
}
else
{
availableItems += ',' + catItem.sys_id;
}
}
}
//Return the advanced Ref Qualifier
return 'sys_idIN' + availableItems;
},
type: 'ReferenceUtilities'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2016 08:51 AM
I was able to use this and it was very helpful. But I want to take the concept a step further and test against a specific user, rather than the current logged in user. Is there a way to do that? Maybe using the user id, or the sys_id of the sys_user record?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 08:23 AM
Ron,
I know i'm a little late in replying to this, but I wanted to say, when you use gs.getUser(), you're retrieving the entire user object. If you were to use .canView() on an entire user object. e.g. gs.getUserByID('user_id_here')