User Criteria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 12:40 AM
hi there
please can you advise if my user criteria script is ok, for some reason it always evaluates to false, even if the condition is met
Thanks
Levino
checkCondition();
function checkCondition(){
var gra = new GlideRecord('sys_user');
gra.addQuery('sys_id', gs.getUserID());
gra.addEncodedQuery('manager=658db0e5db141b00a56336db7c961947^ORmanager=347451691bd3a990f1bebaeccc4bcb55^ORtitleSTARTSWITHCHAPTER^ORtitleSTARTSWITHDCL^ORtitleSTARTSWITHDOMAIN CHAPTER^ORsys_id=c61204c31b85111055f2baeccc4bcb82');
gra.query();
if (gra.next())
return true;
else
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 12:46 AM - edited 04-21-2024 12:51 AM
Hi @levino ,
Could you please elaborate it more what query you have given in Encoded Query ?
Thanks,
Astik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 12:55 AM
user manager as per the sys_id or if the users title starts with chapter, i have tried users which are part of that criteria but it still evaluates to false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 01:01 AM
Hi @levino ,
You can check in the background script whether it is returning something or not. Please navigate to System Definition -> Scripts - Background, and by using different users, you can verify if it is returning records or not
and according make changes to script . check below script to be used in background script -
var gra = new GlideRecord('sys_user');
gra.addQuery('sys_id', gs.getUserID()); // try with different user sys_id
gra.addEncodedQuery('manager=658db0e5db141b00a56336db7c961947^ORmanager=347451691bd3a990f1bebaeccc4bcb55^ORtitleSTARTSWITHCHAPTER^ORtitleSTARTSWITHDCL^ORtitleSTARTSWITHDOMAIN CHAPTER^ORsys_id=c61204c31b85111055f2baeccc4bcb82');
gra.query();
if (gra.next()){
gs.print (true);
}
else
{
gs.print(false);
}
According to that you can make changes to script
If my reply helped with your issue please mark helpful 👍 and correct ✔️ if your issue is resolved.
By doing so you help other community members find resolved questions which may relate to an issue they're having
Thanks,
Astik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 01:18 AM
interesting when i run in background script the same user evaluates to true
user criteria diagnostis is that the way to check i am presuming?