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 think, that should be fine as long as you are creating email template on sc_request table, then only current.sys_id will give you the sys_id of the Request.


anjiadmin
Tera Expert

I am still getting the requested items list.


How can we stop the remaining items apart from the current item associated with the request.



Thanks,


Y Anjaneyulu


PriyaRanji
Tera Guru

Hi Anji Yatham,



Good Day



var gr = new GlideRecord("sc_req_item");


gr.addQuery("request", 'current.sys_id'); /*you are GR the req item table with request */


gr.query();


while(gr.next()) {


template.print(gr.number + ":   " + gr.getDisplayValue('cat_item') + 'Stage :'+ gr.stage); /*hope it gives you the values*/


}



Hope it will helps you out!



Thanks,


Priyanka R


Thanks Priya...But it is not working.


Still I am getting the all items.



Thanks,


Y Anjaneyulu


PriyaRanji
Tera Guru

Hi Anji yatham,



I have a query for the clarification. You want to show all the RITM's which are related to the current request correct.



And also you have used the while which will returns you all the requested items that are related to REQ.



Can you please brief the need from your end?



Thanks,


Priyanka R