
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2019 11:34 AM
Is it possible to retrieve sc_task sys_id value using the sc_req_item sys_id value?
The desired end result would be to create a client side javascript which redirects to the TASK after creating a service request but for that I would need to retrieve the Tasks unique value by using the sc_req_item (RITM ID value)
The ID should look something similar to this: 0af098d4dbb837004fc75c8a68961997
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2019 03:06 PM
Hi Alex,
It is definitely possible. The thing to remember is that one sc_req_item (Request Item) can have multiple catalog tasks (sc_task). So you can query the sc_task table to get the sys_ids of sc_task:
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', <sc_req_item Sys ID>);
gr.query();
while (gr.next()) {
gs.print('Sys Id of sc_task is -->'+gr.sys_id);
}
Try this and let me know if you have any questions.
Please mark this answer as helpful/correct if this solves your problem

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2019 03:06 PM
Hi Alex,
It is definitely possible. The thing to remember is that one sc_req_item (Request Item) can have multiple catalog tasks (sc_task). So you can query the sc_task table to get the sys_ids of sc_task:
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', <sc_req_item Sys ID>);
gr.query();
while (gr.next()) {
gs.print('Sys Id of sc_task is -->'+gr.sys_id);
}
Try this and let me know if you have any questions.
Please mark this answer as helpful/correct if this solves your problem

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2019 10:43 AM
Thank you Abhishek! This was just what I was looking for 🙂