- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have a custom field named Responsible branch office in User table.
I used below user criteria script but its not working.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
is that custom field a reference one?
try to use setWorkflow(false) during query
answer = checkCondition();
function checkCondition(country) {
var user = new GlideRecord('sys_user');
user.addQuery('sys_id',user_id);
user.addEncodedQuery("u_responsible_branch_office=42393ff3835132107f59e530ceaad3fb");
user.setWorkflow(false);
user.query();
return user.hasNext();
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Is the responsible branch always same?
I don't see any issue in this.
You can try removing the country attribute in function declaration
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
is that custom field a reference one?
try to use setWorkflow(false) during query
answer = checkCondition();
function checkCondition(country) {
var user = new GlideRecord('sys_user');
user.addQuery('sys_id',user_id);
user.addEncodedQuery("u_responsible_branch_office=42393ff3835132107f59e530ceaad3fb");
user.setWorkflow(false);
user.query();
return user.hasNext();
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @Ankur Bawiskar
Thanks for the input, it works but Not working for admins ?, Can you suggest anything here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Glad to know that it worked for non-admins.
Why are you worried for admins?
Admins are not going to raise request in Production
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader