The CreatorCon Call for Content is officially open! Get started here.

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

Shishir Srivast
Mega Sage

Please try, if this works



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


No luck.


which is giving all requested items list.


check if this helps.



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


var gr = new GlideRecord("sc_req_item");


gr.get("request", current.sys_id); // Hope you are running template on sc_request table


gr.query();


while(gr.next()) {


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


}


I am calling the script from sla warning notification.




Thanks,


Y Anjaneyulu