Catalog item visibility criteria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 08:55 PM
Hi Team,
The requirement is that a particular catalog item should not be available to a particular title.
That is NOT Visible if job title CONTAINS "xyz".
Have implemented this using the "not available for" with the following code-
var rec = new GlideRecord("sys_user");
rec.addEncodedQuery("sys_idSTARTSWITH" + user_id + "^titleLIKExyz");
rec.query();
if (rec.next()) {
answer = true;
} else {
answer = false;
}
Now the ask is- unable to submit this request for a user with xyz title (tested as individual who is not a user with xyz title, added user who is user with xyz title in requested for).
If anyone could provide insights on this.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 09:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 09:03 PM - edited 09-10-2024 09:03 PM
Hi @Community Alums ,
The starts with is sys id starts with and not the title start with. For the title its title contains itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 09:17 PM
Hi @Anagha Pradeep1 ,
Then you script looks good to me .
use cache.do to clear the cache and try again.
Here is a support article on the caching of user criteria https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0790108.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 09:55 PM
Hi @Anagha Pradeep1 ,
If you have any field of type Requested for then Available for/Not Available for criteria will apply to this field and you will not be able to submit request for that user. On selecting the user it will show "Item is unavailable for this user".
Use Reference field to avoid this.
If this solves your query mark this as correct and helpful.
Thanks
Anand
