- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2017 06:19 PM
Hello,
I need to query sc_req_item from sc_task, I tried different combinations but I could not make it to work. Could someone please assist.
var current_cat_task = g_form.getValue('number');
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',current_cat_task );
gr.query();
while (gr.next()) {
alert('Query working');
}
i also tried.....
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',current.parent);
gr.query();
while (gr.next()) {
alert('Query working');
}
Thank you!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2017 06:43 PM
Hi Jocelyn,
If your on the sc_task, for example calling this script onLoad, you would want to query the sys_id of the sc_req_item which is on the sc_task form in field "request_item".
Here you go:
var req_itm =g_form.getValue('request_item');
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',req_itm);
gr.query();
while (gr.next()) {
alert(gr.number + ' - '+ gr.short_description);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2017 06:43 PM
Hi Jocelyn,
If your on the sc_task, for example calling this script onLoad, you would want to query the sys_id of the sc_req_item which is on the sc_task form in field "request_item".
Here you go:
var req_itm =g_form.getValue('request_item');
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',req_itm);
gr.query();
while (gr.next()) {
alert(gr.number + ' - '+ gr.short_description);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2017 07:27 PM
Thank you Phillip!!! It is working now!