- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 08:59 PM
Hi All,
i need to write gliderecord query on req table and based on that i need to get RITM number for that Req.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 09:12 PM
Hi,
that's correct
something like this
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request.number", "REQ19101");
gr.query();
if (gr.next()) {
gs.info("RITM" + gr.number);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 09:12 PM
Hi,
that's correct
something like this
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request.number", "REQ19101");
gr.query();
if (gr.next()) {
gs.info("RITM" + gr.number);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 09:25 PM
Hey,
I think the relationship between Request and Requested item is established on Requested Item form with Request reference field.
So if you want to check which RITMs are associated with my Request, you will need to glide the RITM table:
var ritmGR = new GlideRecord("sc_req_item");
ritmGR.addQuery("request", current.getUniqueValue());// this works if you are writng BR on request table, this will pass sys_id of the req to the query
ritmGR.query();
while (ritmGR.next()) {
gs.info(ritmGR.getValue("Number"));// this will give sys_ids of RITM, you can mention number if you want to see numbers
}
Aman Kumar