Add "AND" condition in GlideRecord query

PhoenixMing0912
Giga Expert

Hi all,

I found an example of glide record query which is "var queryString = "priority=1^ORpriority=2";".

It's OR condtion, but I am looking for AND.

I have tried "AND" but it didn't work.

Anyone could help?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Phoenix,

For making the query use AND use below

var queryString = "priority=1^priority=2";

in a better way to handle this; create your filter condition from table list layout and use that query in script

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

DirkRedeker
Mega Sage

Hi

Just copy out the condition in the query builder of any list of choice. Then you can learn about the Syntax.

You can do so by right click on the breadcrumbs and copy the query. 

Let me know if that answered your question and mark my answer as correct and helpful, please. 

BR 

Dirk 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Phoenix,

For making the query use AND use below

var queryString = "priority=1^priority=2";

in a better way to handle this; create your filter condition from table list layout and use that query in script

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Vinay Mishra3
Mega Guru

Hi Phoenix,

"AND" clause will not work on choice type field because at a time only once vale can be selected.

For you knowledge below is the query:

var query = "priority=1^priority=2";

 

Please mark correct/helpful, If It's applicable for you.

Thanks,

Vinay

Deepak102
Kilo Contributor

var queryString = "priority=1^priority=2";

Its the way for And 

 

var queryString = "priority=1^Orpriority=2";

 for the Or

 

Thanks