How to create table in Notification Email Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2017 11:41 PM
Hi Friends
I have created one "Notification Email Scripts". for Change Report and i have to use this email script in email notification with table format
1. This is my email script
baseUrl = gs.getProperty("glide.servlet.uri");
var gr = new GlideRecord("change_request");
gr.addEncodedQuery("active=true^assignment_group=dabb461adb373200a91fd001cf96195b");
gr.query();
if (gr.getRowCount() > 0) {
template.print("<br/><br/><br/>Change Request Report:<br/>");
while (gr.next()) {
template.print(" - <a href='" + baseUrl + gr.getLink() + "'>" + gr.getValue('number') + "</a> - " + " - " + gr.short_description + " - " + gr.getDisplayValue('state') + " - "+ gr.getDisplayValue(' type') + "<br/>");
}
}
2. This above script output is below
Change Request Report:- CHG0030008 - - Short Description - New - null- CHG0030009 - - Short Description - Authorize - null- CHG0030010 - - Short Description - Authorize - null- CHG0030011 - - Short Description - Authorize - null- CHG0030012 - - Short Description - Authorize - null- CHG0030020 - - Short Description - New - null
3. I want to send this output as notification (email) in Table format any one can help me how to create table in email script
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2017 11:59 PM
HI Ramesh,
First you will set up condition when email to send,
next what it contains tab..you select table symbol.. i will share image of that symbol check once
what format you want , You can select..and what fields you want send that fields enter with in table.
This answer is helpful please mark helpful and correct mark as correct.
Thanks
Sanjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2017 12:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2017 05:53 AM
Hi Ramesh,
Please try with the below code:
var baseUrl = gs.getProperty("glide.servlet.uri");
var gr = new GlideRecord("change_request");
gr.addEncodedQuery("active=true");
gr.query();
if (gr.getRowCount() > 0) {
template.print('<table border="1"><th colspan="4" style="text-align:center">Change Request Report</th>');
while (gr.next()) {
template.print('<tr><th><a href=' + baseUrl + gr.getLink() + '>' + gr.getValue('number') + '</a></th><th>' + gr.short_description +'</th><th>'+ gr.getDisplayValue('state') + '</th><th>'+ gr.getDisplayValue('type') +'</th></tr>');
}
template.print('/table');
}
Thanks,
Prateek Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2017 07:01 PM