- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 11:20 AM
In Server side background script how to query glide record ... Sys Id is not ..
Below query is not working
var rec = incident.sys_id ( stored incident sysid records)
addQuery('sys_id , '!=', rec);
ANY IDEA
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 11:59 AM
Hi @sukran,
Use the following query instead:
addEncodedQuery('sys_idNOT IN'+rec);
I am assuming the 'rec' variable is an array which stores the sys_ids.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 11:22 AM
Hello @sukran
Please use below code
rec.addEncodedQuery('sys_id!='+rec);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 12:09 PM
Hi Harsh
rec.addEncodedQuery('sys_id!='+rec); its not returning correct data
For Testing (I queried addQuery('sys_id' , rec) = > Its looks good
But != condition not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 12:11 PM
can you post complete script code.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 12:27 PM
My Script code
var exit = new GlideRecord('asmt_assessment_instance');
exit.addQuery('metric=22402a93030393976') // Metric rating
exit.query();
while(exit.next()){
var rec = exit.trigger_id ; // Sys id of engagement
var eng = new GlideRecord('sn_vdr_risk_asmt_vendor_engagement');
eng.addQuery('sys_id' , '!=' , rec); ( Tried 'sys_idNOT IN ' +rec and ('sys_id!='+rec)
eng.query();
while(eng.next()){
gs.print(eng,name);
}
}