Gliderecord query condition "does not equal"

PhoenixMing0912
Giga Expert

Hi all,

I have a query requirement. I would query table by two fields.

One field is "equal", like gr_Relation.addQuery("from_company", company);

The other field is "not equal", how can I write the query?

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You could use something like:

gr_Relation.addQuery("from_company", "!=", company);

So you can just add an operator in the middle, in this case "!=".

Other option, could be to use the breadcrumb on lists. Read about it in this article I wrote a while ago:
Utilizing the breadcrumb on lists to generate your query

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

View solution in original post

2 REPLIES 2

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You could use something like:

gr_Relation.addQuery("from_company", "!=", company);

So you can just add an operator in the middle, in this case "!=".

Other option, could be to use the breadcrumb on lists. Read about it in this article I wrote a while ago:
Utilizing the breadcrumb on lists to generate your query

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

Thank you, I will give it a try.