How to get a List of requested items from a order Guide Request in an email notification?

Ub11
Mega Expert

I have an order guide that auto generates some items and other items a user can select. When the request is created I want a single email that list all items that have been requested to go to the requester.

Number + Cat Item name

The following list shows the information that i would want in the email.

find_real_file.png

1 ACCEPTED SOLUTION

Joaquin Campos
Mega Sage

Hi,

 

You would need to create a notification email script with following code (in this example I'm just adding the number and the item, but you can proceed and include all columns you want):

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

var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while(gr.next()) {
			template.print(gr.number + ":  " + gr.cat_item.getDisplayValue() + "\n");
}

 Then you can call that email script from an email notification with (make sure that notification is setup for sc_request table and it's triggered when a record is updated or inserted):

${mail_script:name_of_your_script}

 

Hope it helps!

 

Joaquín

View solution in original post

1 REPLY 1

Joaquin Campos
Mega Sage

Hi,

 

You would need to create a notification email script with following code (in this example I'm just adding the number and the item, but you can proceed and include all columns you want):

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

var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while(gr.next()) {
			template.print(gr.number + ":  " + gr.cat_item.getDisplayValue() + "\n");
}

 Then you can call that email script from an email notification with (make sure that notification is setup for sc_request table and it's triggered when a record is updated or inserted):

${mail_script:name_of_your_script}

 

Hope it helps!

 

Joaquín