- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2017 08:34 AM
I want to send an email with a summary with the Request Number and all the RITM's
I have the following script
template.print('<p>' + 'Click here to view request: ' + '${request.URI_REF}');
template.print("<br />");
template.print("Summary of Requested items:");
template.print("<br />");
var gr = new GlideRecord("sc_req_item");
//gr.addQuery("request", current.sys_id);
gr.addQuery("sys_id", current.sysapproval);
gr.query();
while(gr.next()) {
}
template.print(gr.number + ": " + gr.cat_item.getDisplayValue());
}
But, I only get this
Click here to view request: REQ0010312
Summary of Requested items:
undefined: undefined
Can you let me know what I have wrong?
Many thanks in advance...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2017 09:17 AM
Please check now, above code contains brackets closed between while and template. Now copy paste the exact code and check the results and please let me know.
template.print('<p>' + 'Click here to view request: ' + '${request.URI_REF}');
template.print("<br />");
template.print("Summary of Requested items:");
template.print("<br />");
var gr = new GlideRecord("sc_req_item");
gr.addQuery('request',current.request);
gr.query();
while(gr.next()) {
//} remove this line, because of this it prints one record only.
template.print(gr.number + ": " + gr.cat_item.name);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2017 10:50 AM
Didn't work. No show for the RITMs
Click here to view request: REQ0010322
Summary of Requested items:
REQ0010322: undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2017 11:25 AM
can you please let me know what the gs.log prints
gs.log('AAAA:The request number is:'+current.request);
template.print('<p>' + 'Click here to view request: ' + '${request.URI_REF}');
template.print("<br />");
template.print("Summary of Requested items:");
template.print("<br />");
var gr = new GlideRecord("sc_req_item");
gr.addQuery('request',current.request);
gr.query();
gs.log('AAAA: Total records are:'+gr.getRowCount());
while(gr.next()) {
}
template.print(gr.number + ": " + gr.cat_item.getDisplayValue());
}
please tell me what above gs.log returning.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2017 07:58 AM
Sorry for what I am about to ask but
Where do I find the gs.log results?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2017 08:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2017 09:00 AM
The above log statements returns 3 records, The script is working, try one more time and check the results
template.print('<p>' + 'Click here to view request: ' + '${request.URI_REF}');
template.print("<br />");
template.print("Summary of Requested items:");
template.print("<br />");
var gr = new GlideRecord("sc_req_item");
gr.addQuery('request',current.request);
gr.query();
while(gr.next()) {
}
template.print(gr.number + ": " + gr.cat_item.name);
}