- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2022 08:07 AM
I'm creating a notification on the Case table, that will send a notification when a case has been updated by the customer. In the 'What it will contain' portion of the notification, I'd like to include the most recent update made by the customer. Currently, I've added the 'Additional comments' variable, but it displays all additional comments in the case. I only want to show the most recent additional comment by the customer, that triggered the notification.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2022 08:37 AM
Hello MStritt,
You need to use email script to achieve this requirement.
Please follow the below steps.
1. Create a Email notification script and add the below script.
Lets assume the name of this script is : case_email_notification
var latestCom = new GlideRecord('sys_journal_field'); // Sys Journal is the table which contains all work notes and comments
latestCom.addEncodedQuery('element_id=' + current.sys_id); //no need to change this
latestCom.orderByDesc('sys_created_on');
latestCom.setLimit(1); // this will ensure to pick the latest comment made on the case
latestCom.query();
if (latestCom.next()) {
template.print('<p><font size="6" color="#808080" face="helvetica">');
template.print(latestCom.value); // printing the latest comment. no need to check this field until unless you modified the value field in Sys Journal table(Which I doubt)
template.print('</font></p>');
2. Open your notification and add this Email notification script in the message HTML like below:
${mail_script:case_email_notification} .
It will fix your issue. Check and let me know if it fixed your issue or not.
Thanks,
Bhavani.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2022 11:16 PM
@MStritt I'm surprised you didn't accept my solution, Basically you don't need to gliderecord journal table, you can simply do like below. Can you accept my solution as well ?
Email script
(function runMailScript(current, template, email, email_action, event) {
template.print('Comments '+current.comments.getJournalEntry(1));
})(current, template, email, email_action, event);
And in notification 'What will contain' just call script
${mail_script:test123}
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2022 07:18 AM
Hello MStritt,
You have to keep the Updated checked. When you said "every time the case is updated", you mean if you make any update like updating assigned to, changing short description or description? If you are receiving email for these updates as well, then
In Email Notification definition below inserted and updated check boxes you have a condition builder. In that you need to set an condition as below
Worknotes changes / Additional comments changes
In this way system will trigger emails only when there is a update made on work notes/ additional comments only and not triggers emails if there are any changes made on cases.
Please check and let me know whether this answers your query or not.
Thanks,
Bhavani.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2022 08:02 AM
You have to keep the Updated checked. When you said "every time the case is updated", you mean if you make any update like updating assigned to, changing short description or description?
<Correct>
Unfortunately, I don't want a notification even if a work note (internal) is made. Or, additional comment if it's made by the agent. Only when the customer makes an update (additional comment).
customer_updated is Yes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2022 08:19 AM
In general cases will be updated by respective assignment group members / subject person only.
I am not sure how many of your customers will update cases(I am assuming this number is big). If you could provide more information on this, it would be good.
If more customers will update cases regularly then you need to find a common role or any other property to use it in condition builder.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2022 09:30 AM
I think I just need to change the condition from 'customer updated is Yes' TO 'customer updated changes to Yes'.