We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Script for User Criteria on Virtual Agent Topics

Don Dom
Tera Contributor

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.

4 REPLIES 4

Anirudh Pathak
Giga Sage

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 Roethof
Tera Patron

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

LinkedIn

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.

Don Dom
Tera Contributor

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);