Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Record Producer User Criteria not working

Supriya25
Tera Guru

Hi All,

I'm not sure what's wrong with this user criteria , please help me 
use case : get True or false

Supriya25_3-1789663739254.png

 

 

Supriya25_4-1789663766960.png

 

Supriya25_2-1789663673546.png

My humble request kindly help me on this , I tried with different ways too
String(user_id) or user_id or gs.getUserID()


script :

gs.addInfoMessage("VC Details 2 ");
gs.info("VC Details 2 ");
var vc = new global.TestVC();
answer = vc.userCriteria(String(user_id));


script Include :
var TestVC = Class.create();
TestVC.prototype = {
initialize: function() {},

userCriteria: function(userid) {
gs.addInfoMessage('VC Details');
gs.info('VC Details');
if (!userid) {
return false;
}
return true;
},

type: 'TestVC'
};


why info messages not coming, if this comes I have to design my major functionality 

with combinaiton of System Property and User Role Check
if (system property==true)
{
if(check user role is at least one ){
answer=true;
else
answer=false;
}

}

 

2 REPLIES 2

Chaitanya ILCR
Giga Patron

Hi @Supriya25 ,

1. If you are trying with admin. Admin users bypass the users criterias

2. impersonate a user and test you will get the message 1 time

3. if you trying to reimpersonate the same user ->User criteria are cached for the users

run the below line of code in the background script to clear the cache and try

gs.cacheFlush()

 

 

Regards,
Chaitanya

Tanushree Maiti
Tera Patron

Hi @Supriya25 

 

Ensure you are not testing using Admin id.

Impersonate by requested user profile and test.

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti