- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 06:40 AM
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?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 06:43 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 06:43 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 06:47 AM
Thank you, I will give it a try.