How to get the catalog task number associated with a requested item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2017 03:45 AM
for my requested item a catalog task is generated . I want to get the the task number which is present in in related list in my requested item form.How can i get it using background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2017 03:57 AM
Hi Dutta,
Try below code for getting the single task number for single request.
var gr=new GlideRecord('sc_task');
gr.addQuery('request_item','RITM sys_id');//provide the ritm sys_id
gr.query();
if(gr.next())
{
gs.log("TAsk num"+gr.number);
}
Let me know if you have any queries.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2017 03:59 AM
There is a typo on @kalyan script.
Here is the updated one
var gr=new GlideRecord('sc_task');
gr.addQuery('request_item','RITM sys_id');//provide the ritm sys_id
gr.query();
while(gr.next()) // if you have multiple tasks associated with RITM
{
gs.log("TAsk num"+gr.number);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2017 04:12 AM
Thanks Kalyan ,
In the same way i did also.
I was just trying that if can we take the the object of sc_req_item and get the related list details
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2017 04:21 AM
you can get the full sc_req_item object like so...
var sid = (whatever the sys_id of the requested item is)
var bubotuber = new GlideRecord('sc_req_item');
bubotuber.get(sid); //bubotuber is now the full sc_req_item object
... but to get the related sc_tasks, you also have to do a query like those shown above.