How can I get the variable value from the RITM record?

Danny Sun
Tera Guru

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.        

1 ACCEPTED SOLUTION

bt6lw
Giga Contributor

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.


View solution in original post

10 REPLIES 10

Thank you Sir!!