Embedding a dynamic table into an email notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2013 10:08 PM
Hi,
I am looking to send out a notification that would include data from a recordset. So, in short, I need to have a mail script dynamically create a table and populate that table with the data in the recordset. Here is what I have tried but there is no output.
This script is just a test to see if I can produce a small table with a small set of information.
// get the reference for the body
var body = document.getElementsByTagName("body")[0];
// creates a element and a element
var tbl = document.createElement("table");
var tblBody = document.createElement("tbody");
// creating all cells
for (var j = 0; j < 2; j++) {
// creates a table row
var row = document.createElement("tr");
for (var i = 0; i < 2; i++) {
// Create a in the
tbl.appendChild(tblBody);
// appends into
body.appendChild(tbl);
element and a text node, make the text // node the contents of the | , and put the | at // the end of the table row var cell = document.createElement("td"); var cellText = document.createTextNode("cell is row "+j+", column "+i); cell.appendChild(cellText); row.appendChild(cell); } // add the row to the end of the table body tblBody.appendChild(row); } // put the |
- Labels:
-
Analytics and Reports
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2013 02:06 AM
can you try using
instead
template.print("<table><tr><td>"+ a field value from your record set like gr.number+"</td></tr></table>");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2013 08:20 PM
I had a same requirement in the past to push details from the table in the email in a tabular format.
There are two options that you can do,
1) Create an HTML field on the approval/requested table, populate the HTML field with the tabular form details, and use the same field to print in email using template.print(field Name).
2) Build a tabular format results in the email script part using template.print(html code).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2013 09:24 PM
Thanks Everyone,
This help me a lot and I got it done. What I had to accomplish was to send a notification to each location with a list of their closed incidents. Doing it this way I was able to NOT have to create a scheduled report for each and every location. Instead, I performed a query on the location table, then the incident table and called the event for the notification if there were incidents for that location. This was done in the scheduled jobs module.
Thanks again for the tip
Phil Wright
CompuCom Systems
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2013 11:17 PM
or maybe some guidance on how you accomplished this? I have a very similar task at hand and am not sure where to even begin.
Any help would be appreciated.