
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 12:48 PM
Hello. We have an Email Notification (Activity Stream @Mention Email) which uses an Email Script (ng_activity_mention_body).
The same notification and email script are used for Incident records and Project Task records.
We have noticed that when this notification is sent for an Incident, the incident number is included in the Subject and Body. However, when the notification is sent for a Project Task, the Short Description from the project task is used, in place of the number.
We would like the number to be displayed in the notification for project tasks, just as it is for Incidents.
Example notification for Incident:
Subject: You have been mentioned in INC0000001
Body: You have been mentioned by Joe in the Incident record INC0000001
Example notification for Project Task:
Subject: You have been mentioned in Customer Go-Live - Add blade servers
Body: You have been mentioned by Joe in the Project Task record Customer Go-Live - Add blade servers
Here is the Email script: ng_activity_mention_body
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var result = new ActivityMentionEmailValues().getEmailValues(current.table, current.document);
if (result) {
result = JSON.parse(result);
email.setSubject(gs.getMessage("You have been mentioned in {0}", result.subjectText));
template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'>");
template.print(gs.getMessage("You have been mentioned by {0} in", current.user_from.name));
template.print(" <a>" + result.linkText + "</a></p>");
}
})(current, template, email, email_action, event);
Can anyone point me in the right direction?
Solved! Go to Solution.
- Labels:
-
Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 08:02 AM
That is why I have asked you to verify Dictionary Override for short_description field.
See the below images for reference;
As you can see that display value for Number field is set to true for vtb_task table.
But still I am getting short_description as display value in my script result.
Script:
Output:
Record:
This is because Override display value for short_description is set to true.
If I set it to false then I will get Number.
By the way the image you have shared is not visible.
Hopefully, it will help you understand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 01:07 PM
Hello Justin,
i think the values are returning from the script include ctivityMentionEmailValueS
I think in the script include you must be returning the display value of the field in which for incident the display value is set to true for number field in dictionary of incident table which is returning correctly .
It might be a case where for project task table short description field is set to display true which is inturn getting the short description as a result .
Please check that and change un check the display true to project task short description and check it to true for project task number field in project task table dictionary
please mark my answer correct if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 01:08 PM
Hi Justin,
Your are basically using the following Script Include in your mail script which is returning result in string of JSON.
This script include is setting values using getDisplayValue(). So, as per my understanding, the display value column for Incident table is Number while for Project Task it could be Short Description.
Hopefully, this will give you a direction to debug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 01:09 PM
Hello Justin,
Can you please try to print the value of result before and after parsing line and check -
result = JSON.parse(result);
Basis on this you can look up to the value being passed through result.subjectText in the next line.
Let me know if issue still persists.
Mark this as helpful if it helps.
Kind Regards,
Shubham

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2022 06:36 AM
Hi