How can we get the requested item related to current request?

anjiadmin
Tera Expert

How can we get the requested item related to current request?

I able to to get the requested items along with the current request item.

But I want to display the requested item related to current request.

I am using the below code.

template.print("<p></p>Requested items:<br />");

var gr = new GlideRecord("sc_req_item");

gr.addQuery("request_item", current.sys_id);

gr.query();

while(gr.next()) {

template.print(gr.number + ":   " + gr.cat_item.getDisplayValue() + ", Stage: " + gr.stage.getDisplayValue() + "<br />");

}

Regards,

Y Anjaneyulu

18 REPLIES 18

I am calling the from the notification on   "task_sla" table.




Thanks,


Y Anjaneyulu


Hi,



Ohk...then fine!



Thanks,


Priyanka R


Hi Anji,



Good Day



You can mark your's as correct answer, it is working fine!



Thanks,


Priyanka R


Hi all,



I have to generate a Gliderecord list, where Request is still open and attached Requested Items are closed or closed incomplete.



var str = 'request.request_stateNOT INclosed_complete,closed_incomplete^stateINclosed_complete,closed_incomplete';


var gr = new GlideRecord('sc_req_item');


gr.addEncodedQuery(str);


gr.query();


while(gr.next())


{


gs.print('Requested Item is :' + gr.request.number);


}



However, I think this would not capture our one scenario. That is


REQ123 has got 3 RITMs RITM1, RITM2 & RITM3.



Out of 3 RITMs, RITM2 & RITM3 are closed however RITM is still open. Then as per my gliderecord that Request also get captured. Which I don't want because its one RITM is still open.


Could anyone of you please let me know what needs to be corrected to avoid such rows.



Any help must be appreciated