- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 11:34 AM
In continuation to this question
https://community.servicenow.com/community?id=community_question&sys_id=7e3e79861be2cd50d018c8ca234bcb9c
I am getting output as "INC0000001RITM0010001"
but I am excepting output as..{table format}
Number |
INC0000001 |
RITM0010001 |
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 11:57 PM
Hi
As discussed in your last post , if you want to have it as a Tabular format then please update your last code which I helped you out with below code.
This will give you the details in Tabular Format
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var getArray = event.parm1.toString();
var splitStr = getArray.split(',');
template.print('<table border="1">');
for (var i = 0; i < splitStr.length; i++) {
template.print("<tr>");
template.print("<td>" + 'Number' + "</td>");
template.print("<td>" + splitStr[i] + "</td>");
template.print("</tr>");
}
template.print("</table>");
})(current, template, email, email_action, event);
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 01:50 PM
Hi Sathwik,
I guess your output is a string separated by comma, right?
Simply run replaceAll function and replace a space with \n
Note: in case the email is in HTML format you may need to replace it with <BR> not \n to break the line in HTML
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 01:58 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 02:24 PM
Hey,
are you referring to an HTML table with all the <td> and <tr> tags? Alternatively <div> tags?
If you need just a simple text formatted to look like a table, you can do what I suggested earlier. To get the header, just add whatever you need at the beginning with comma by using concat (don't forget to keep one extra space in the header so it is also replaced with new line tag):
And the output will be like this (without the *** script: part)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 06:47 PM