SYS Is not in query ?

sukran
Mega Sage

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

1 ACCEPTED SOLUTION

James Chun
Kilo Patron

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

View solution in original post

11 REPLIES 11

Did you also debug exit.trigger_id, does it contain the value you would expect?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

exit.trigger_id = returns sys id as expected

James Chun
Kilo Patron

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

Its works with mentioned code

var usrLoc=[];

addEncodedQuery("sys_idNOT IN"+usrLoc);

 

Passing the value to array ,then its looks good

Mark Roethof
Tera Patron
Tera Patron

It should be able to work. The other suggestions are fine to. Question is more, is the other content in your query valid, did you verify? For example "rec", is that valid? Did you debug?

 

What can you share.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn