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

Welcome



Thanks


Pradeep Sharma


Hi Pradeep



scOption.addQuery('number','RITM2061426'); Can the RITMnumber be obtained in business rule using current.xxxxx???


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.


Hi Willem,



Thanks for you help. It can works well.



Regards,


Danny


bt6lw
Giga Contributor

Very glad my solution worked.



Will you be so kind as to mark the question as answered?