- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 10:45 AM - edited 05-28-2025 10:47 AM
Hi,
I have a requirement to remove lines for every comment in email script.
Thanks in Advance,
Harika
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 11:50 AM
Hey Harika,
Replace:
html += '<p><strong>' + createdOn + ' - ' + author + '</strong><br>' + comment + '</p>';
with:
html += '<p><strong>' + createdOn + ' - ' + author + ' – Additional comments</strong><br>' + comment + '</p>';
Could you also mark my response with correct and helpful?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 11:03 AM
can you share the email script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 11:12 AM
(function runMailScript(current, template, email, email_action, event) {
template.print('<p><font size="2" face="verdana">' + gs.getMessage('${comments}') + '</font></p>');
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 11:20 AM
To remove the lines between comments in your email output, you need to customize how the journal field (comments or work_notes) is rendered in the email.
The default rendering includes a horizontal rule (<hr>) or styled separator — that’s what’s creating the lines. In order to get rid of them you have to build the HTML yourself, instead of using ${comments} which includes those lines.
Something along those lines should do the trick, please check and adjust:
(function runMailScript(current, template, email, email_action, event) {
var journalFieldName = 'comments'; // use 'work_notes' if needed
var gr = new GlideRecord('sys_journal_field');
gr.addQuery('element_id', current.sys_id);
gr.addQuery('element', journalFieldName);
gr.orderByDesc('sys_created_on');
gr.query();
var html = '<div style="font-family: Verdana; font-size: 12px;">';
while (gr.next()) {
var createdOn = gr.getValue('sys_created_on');
var author = gr.getDisplayValue('sys_created_by');
var comment = gr.getDisplayValue('value');
html += '<p><strong>' + createdOn + ' - ' + author + '</strong><br>' + comment + '</p>';
}
html += '</div>';
template.print(html);
})(current, template, email, email_action, event);
Please mark this response as correct and helpful if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 11:46 AM
Hi Hristo,
This code works. but what if i want to add Additional comments text at end of line?
Thanks,
Harika