How to write subqueries?

harry24
Tera Contributor

How to write subqueries in servicenow?

4 REPLIES 4

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Can you explain your question a bit more?

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

Like we have sub-queries in sql where one queries input is given to other.

Eg select * from table where (some query here)

asifnoor
Kilo Patron

Hi,

There is no direct method to write sub queries. But you can use addJoinQuery of Gliderecord.

Alternative you can do a gliderecord query and fetch the results into an array and then use addQuery with IN operator.

Kindly mark the comment as a correct answer and also helpful if this answers your question.

Nikhil Phalke
Kilo Guru

Hi Harry,

 

Go through following link it might help you.

https://community.servicenow.com/community?id=community_question&sys_id=cea24f21dbd8dbc01dcaf3231f96...

Here you will find an example of addjoinquery.

Please Mark helpful and correct based on impact.

Regards

Nikhil