- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 04:17 PM
Hi everyone,
I've got an email script that adds the requested items associated with a parent request to an email as seen below. What I need is for each of those requested items to appear as a hyperlink to their record in SN. My email script is below.
here's my script...not sure what to add to it to get the hyperlinks going....thanks!
template.print("<p></p><strong>Requested item(s)</strong><br />");
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() + "<br />");
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 05:06 PM
here you go..
template.print("<p></p><strong>Requested item(s)</strong><br />");
var baseURL = gs.getProperty('glide.servlet.uri');
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() + "<br />"););
template.print("<a href=" + baseURL + gr.getLink() +">" + gr.number + "</a>");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 05:06 PM
here you go..
template.print("<p></p><strong>Requested item(s)</strong><br />");
var baseURL = gs.getProperty('glide.servlet.uri');
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() + "<br />"););
template.print("<a href=" + baseURL + gr.getLink() +">" + gr.number + "</a>");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 05:15 PM
Hello Patrick,
Below is the updated code.
template.print("<p></p><strong>Requested item(s)</strong><br />");
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while(gr.next()) {
var baseURL = gs.getProperty("glide.servlet.uri");
template.print("<a href=" + baseURL + gr.getLink() +">" + 'inc'+ "</a>" + ": " + gr.cat_item.getDisplayValue() + "<br />");
}
Note Untested code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 05:15 PM
Hello Ajit,
thanks for the reply. I'm getting an error with your code on the line below.
template.print("<p></p><strong>Requested item(s)</strong><br />");
var baseURL = gs.getProperty('glide.servlet.uri');
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() + "<br />");//this line is giving me the red circle alert, so I removed the extra );
template.print("<a href=" + baseURL + gr.getLink() +">" + gr.number + "</a>");
}
I think it's close, here's the result I'm getting...just jumbling the requested item numbers a little. I only need it to list the number that is the hyperlink, and for that to be the first number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 05:17 PM
actually got it with a little adjustment of your script.
thanks!
template.print("<p></p><strong>Requested item(s)</strong><br />");
var baseURL = gs.getProperty('glide.servlet.uri');
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while(gr.next()) {
template.print("<a href=" + baseURL + gr.getLink() +">" + gr.number + "</a>");
template.print(": " + gr.cat_item.getDisplayValue() + "<br />");
}