- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2014 07:54 PM
I want to get a variable value from the RITM record, the value is from one of the request form. I try to get it from the 'sc_item_option_mtom' table, but i did not work.
var scOption = new GlideRecord('sc_item_option_mtom');
scOption.addQuery('request_item.number','RITM2061426');
scOption.query();
while(scOption.next()){
//get the value of the term_date
gs.log("Term Date="+scOption.sc_item_option.term_date.value);
}
Are there any questions about this?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2014 08:50 PM
Don't have my reference handy of our implementation. I am quite sure however, you should be able to do a gliderecord lookup to the sc_req_item. This is assuming your variable is attached here - which it normally would be - but i've seen some funnny implementations.
so... you can copy this exactly - just change the "YOURVARIABLENAME" with the name of the variable you are referencing. (This would be the "item_option_new" table. The element is "name'.
var gr = new GlideRecord('sc_req_item');
gr.addQuery('number', 'RITM2061426');
gr.query();
if (gr.next())
{
gs.log(gr.variable_pool.YOURVARIABLENAME);
}
Please let me know if you struggle, I use this kind of lookup for many different validations / process steps from Service Catalog.
Regards
Willem.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2014 08:39 PM
Hi Danny
Try the below script:
var scOption = new GlideRecord('sc_req_item');
scOption.addQuery('number','RITM2061426');
scOption.query();
while(scOption.next()){
var server = scOption.variables.server_name;//Replace "Server_name" with your variable name
gs.addInfoMessage(server);
}
Let me know if you have any questions
Thanks and Regards
Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2014 09:11 PM
Hi Pradeep,
I try to use the script you mentioned, but it still don't to work. I output this: scOption.variables.term_date, but the value is "undefined". It seem that it can't get the variable value. Thanks for you help.
Regards,
Danny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2014 09:51 PM
I don't think it should be the script issue
Please check if you can get the value of "term_date" at "RITM" level with the help of business rule.
Also if you can replicate it on any demo instance, I can verify and help you there.
Thanks
Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2014 09:17 PM
Thank you very much. This question has been resolved.
Regards,
Danny