Script for User Criteria on Virtual Agent Topics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 02:04 AM - edited 03-15-2024 02:05 AM
Hello.
I have 2 different user criteria.
All UK User
All DE Germany
I want to set that only users under those User Criteria can see/work with one specyfic Virtual Agent Topic.
What I see User Criteria is still not available for VA Topics? Yes?
But we have a script.
Any one got script that checks if user belongs to this User Criteria he can see/work/talk with this one specyfic Virtual Agent Topic?
Thx in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 07:02 AM
Hi @Don Dom ,
Does your user criteria is based on, if the user is part of some group?
If yes, then you use the below code in the script section -
if(gs.getUser().isMemberOf("YourGroupName")) {
return true;
}
else {
return false;
}
Also, if user criteria is not based upon any group. You can share the logic of your user criteria.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 07:31 AM
Hi there,
To verify:
You want to script within VA, to evaluate an existing User Preference, so you kind can re-use that?
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 01:00 AM
Hello.
What I see se there is no way to user user criteria inside VA Topic.
I would like to script it in a script section that Topic will be used only by people in user criteria group 🙂
Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 06:40 AM
UserCriteriaLoader - API to Evaluate User Criteria - ServiceNow Community
Worked for me 🙂
var userCriterias = ['6b6df061ff2121009b20ffffffffff44','0b5b0e6453631300afffddeeff7b1201']; var userMatches = sn_uc.UserCriteriaLoader.userMatches(gs.getUserID(), userCriterias); gs.info(userMatches);