- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 02:13 AM
We have a requirement that all the comments added in a RITM should be available in email notifications.
In our system, when an RITM is generated, there could be multiple tasks assigned to different teams.
The team handling the RITM should be able to see what updates have been added by the task groups.
As of now it only shows the last 2 updates, if we add the comment field in the notification.
How can we see all the comments that were added?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 02:37 AM
Hi @prithatcs
You can write an email notification script as below:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
template.print('<br/>');
template.print('<font size="3" color="#000000" face="arial">');
template.print('<b>Comments:</b><br/><br/>');
template.print(current.comments.getJournalEntry(-1));
template.print('</font>');
})(current, template, email, email_action, event);
It is mandatory that you add the value as -1, else you would not get all the comments.
Similarly you can add it for work notes as well.
Hope this helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 03:13 AM
var notes = current.comments.getJournalEntry(-1);
var na = notes.split("\n\n");
for (var i = 0; i < na.length - 1; i++) {
var finalComments = "";
var str = na[i];
if (i == 0)
finalComments = str.split('\n').slice(1).join('</br>') + "</br>" + "</br>";
else
finalComments = str.split('\n').slice(0).join('</br>') + "</br>" + "</br>";
if (!JSUtil.nil(finalComments))
var finalcomments1 = "";
finalcomments1 = finalComments.replace(/<br\/>/g, '');
//template.print(mf.findMessage(finalcomments1, lang));
template.print(gs.getMessageLang(finalcomments1, lang));
use above mail script and add the mail script name it to your notification's Message HTML as per below
<p>Comments Added: </p>
<p>${mail_script:getComments}</p>
If you satisfied with the answer please Accept the solution or mark helpful.
Thank you,
vallabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 02:25 AM
to get all journal entries use below code-
var comments = current.work_notes.getJournalEntry(-1) //gets all entries.
Use above code to get all comments.
Mark this answer as correct
Thanks,
Manjusha Bangale

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 02:37 AM
Hi @prithatcs
You can write an email notification script as below:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
template.print('<br/>');
template.print('<font size="3" color="#000000" face="arial">');
template.print('<b>Comments:</b><br/><br/>');
template.print(current.comments.getJournalEntry(-1));
template.print('</font>');
})(current, template, email, email_action, event);
It is mandatory that you add the value as -1, else you would not get all the comments.
Similarly you can add it for work notes as well.
Hope this helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 03:13 AM
var notes = current.comments.getJournalEntry(-1);
var na = notes.split("\n\n");
for (var i = 0; i < na.length - 1; i++) {
var finalComments = "";
var str = na[i];
if (i == 0)
finalComments = str.split('\n').slice(1).join('</br>') + "</br>" + "</br>";
else
finalComments = str.split('\n').slice(0).join('</br>') + "</br>" + "</br>";
if (!JSUtil.nil(finalComments))
var finalcomments1 = "";
finalcomments1 = finalComments.replace(/<br\/>/g, '');
//template.print(mf.findMessage(finalcomments1, lang));
template.print(gs.getMessageLang(finalcomments1, lang));
use above mail script and add the mail script name it to your notification's Message HTML as per below
<p>Comments Added: </p>
<p>${mail_script:getComments}</p>
If you satisfied with the answer please Accept the solution or mark helpful.
Thank you,
vallabh