
- 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:41 PM
Thanks for the helpful replies! I've reviewed all the table Dictionary entries and verified the Display value is set to false for every table column, in all of the tables below.
task
incident
pm_project
pm_project_task
Perhaps [incident] defaults to the Number and [pm_project_task] defaults to the Short Description, when all Table Column Display values are set to false?
The ServiceNow doc, 'Select a field as the table display value', indicates the following:
Reference fields look for the display value in the following order:
- A field with display=true in the system dictionary on the lowest sub-table for extended tables.
- A field with display=true in the system dictionary on the parent table.
- A field named name or u_name.
- The Created on field of the referenced record.
If the above were the case, I would expect to see the 'Created on' field being used, since display=false for everything and there is no 'name' or 'u_name' field on these records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 01:57 PM
Did you check for Dictionary Override Override display value on the column which you are getting like short description

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 06:45 AM
I have set the Display value for Number in the pm_project_task table, but the notifications for project tasks still includes the Short Description.
- 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-05-2022 06:34 AM
Thank you very much Muhammad! This helped a lot and has resolved the problem.