How to find the catalog tasks which are associated with the RITM's?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 08:40 PM
Hi,
Using background script, how to find the catalog tasks that are associated with RITM?
Please help me with the request above.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 08:55 PM
You can test this in bg script
var ritm = new GlideRecord('sc_req_item');
ritm.query();
while(ritm.next())
{
var task = new GlideRecord('sc_task');
task.addQuery('request_item',ritm.sys_id);
task.query();
while(task.next())
{
gs.info("RITM"+ritm.number + " Catalog Task "+task.number);
}
}
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 09:02 PM
Hi
var query = "active=true^request_item=" + REQUEST-ITEM-SYSID;
var grTask = new GlideRecord('sc_task');
grTask.addEncodedQuery(query);
grTask.query();
while(grTask.next()) {
gs.info("Associated Task: " + grTask.number);
}
Please try to use active=true/false query based on requirement to avoid slower query times.
Please mark my answer as Helpful / Correct if my response helped you.
Regards,
Vamsi S