Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Run User Criteria on the basis of Session URL

Harsh Ahuja
Tera Contributor

Hi Community,

 

I am having a scenario in which I want to run User Criteria for a record producer only for Agent Workspace.

In short I want to restrict the user criteria for Portal. For that the below user criteria script is written but this is not working.

var url = gs.getProperty("glide.servlet.uri") + gs.action.getGlideURI();

var userRec = new GlideRecord("sys_user");
userRec.addEncodedQuery('location.country=INDIA^active=true');
userRec.query();
if (url.indexOf('workspace') > -1) {
if (userRec.hasNext())
answer = true;
else
answer = false;
}

Your reply will be helpful.

6 REPLIES 6

Harsh Ahuja
Tera Contributor

HarshAhuja_0-1682318096601.png

 

Harsh Ahuja
Tera Contributor

Hi Rahul,

 

Thanks for your reply over the thread, I tried your mentioned script but this is not working as expected. The record producer is visible in both Service Portal & Agent Workspace but we want to restrict it for Service Portal.

HarshAhuja_0-1682327182847.png

Thanks, your reply will be helpful.