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.

User Criteria not working

Ed Hefford
Tera Guru

Hi All,

We have had some user criteria established for a while on our KB and Catalog items.

We're using the advanced script as follows to check if a user has a Staff ID, meaning only staff should be able to access the item in question:

(function() {
var staffId = gs.getUser().getRecord().getValue('u_staff_id');
return !gs.nil(staffId);
})();

This doesn't want to seem to work. Is there any other way to get this function to work correctly?

Thanks,

Ed

1 ACCEPTED SOLUTION

Cuong Phan
Kilo Sage

Hi Ed,

 

User Criteria is cached when you use admin user. Make sure you double check:

- Impersonate not admin user

- Clear cache servicenow by https://devxxxx.service-now.com/cached.do

- Clear cache browser or open another browser to impersonate correct answer

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

 

Cuong Phan

DXC Consultant.

 

Regards,
Cuong Phan
ServiceNow Technical Lead

View solution in original post

2 REPLIES 2

Cuong Phan
Kilo Sage

Hi Ed,

 

User Criteria is cached when you use admin user. Make sure you double check:

- Impersonate not admin user

- Clear cache servicenow by https://devxxxx.service-now.com/cached.do

- Clear cache browser or open another browser to impersonate correct answer

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

 

Cuong Phan

DXC Consultant.

 

Regards,
Cuong Phan
ServiceNow Technical Lead

hi @Cuong Phan ,

Thanks for this - that seems to have worked. Great help, thank you!