- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2019 07:51 AM
I want the Short descritpion to follow email shown here.
You have been mentioned by Root Mathew Xagoraris in CS0026575 "Short Description"
this is my current code, any thoughts? The code below is in Notification Scripts. Note I added current.short_description in the script below, everything but that works.
var recordGR = new GlideRecord(current.table);
var field = current.field_name;
if(recordGR.get(current.document)) {
email.setSubject("You have been mentioned in " + recordGR.getDisplayValue());
template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'>You have been mentioned by " + current.user_from.name + " in <a href='/" + recordGR.getRecordClassName() + current.short_description +".do?sys_id=" + recordGR.getUniqueValue() + "'>" + recordGR.getDisplayValue() + "</a></p>" + '<br>' + 'Comments: ' + current.document[field].getJournalEntry(1));
}
Solved! Go to Solution.
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 08:00 AM
Hi zag
The current object is the live_notification table and this table does not have a short_description field, which is why current.short_description returns undefined. You need to use recordGR.short_description instead - the below seems to work for me:
var recordGR = new GlideRecord(current.table);
if(recordGR.get(current.document)) {
template.print("<span style='font-size: 10pt; font-family: verdana, geneva;'>You have been mentioned by " + current.user_from.name + "in <a href='/" + recordGR.getRecordClassName() + ".do?sys_id=" + recordGR.getUniqueValue() + "'>" + recordGR.getDisplayValue() + ' "' + recordGR.short_description + '"' + "</a></p>");
}
- Matt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2019 08:25 AM
You are putting the short description within the URL link for the record. You need to put the short description after the </a> so something like:
template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'>You have been mentioned by " + current.user_from.name + " in <a href='/" + recordGR.getRecordClassName() + ".do?sys_id=" + recordGR.getUniqueValue() + "'>" + linkText + "</a> : " + current.short_description + " </p>" + '<br>' + 'Comments: ' + current.document[field].getJournalEntry(1));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2019 08:41 AM
Hi Jeff,
thanks for the insight! The + "'>" + linkText part of the code seems to remove the all the text . I took that out but now I get undefined any thoughts as to why?
You have been mentioned by Root Mathew Xagoraris in CS0026575 : undefined
If you would like to stop receiving these emails you can disable "Activity Stream @Mention Email" in your Notification Preferences or Unsubscribe. |

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2019 10:17 AM
Maybe show me your full script. The LinkText is the CS0026575. If you click CS0026575 does it take you to the correct case? if so, then the URL is working too and just the short description is not defined correctly.
Below is my script, which I think it 100% out of the box, just for reference. Looking at this closer (without testing, sorry), I think you may need recordGR.get(current.short_description)
var recordGR = new GlideRecord(current.table);
if(recordGR.get(current.document)) {
var displayValue = recordGR.getDisplayValue();
var subjectText = displayValue
? displayValue
: "a record discussion";
var tableDisplay = recordGR.getClassDisplayValue();
var linkText = displayValue
? "the " + tableDisplay + " record " + displayValue
: "this " + tableDisplay + " record ";
email.setSubject("You have been mentioned in " + subjectText);
template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'>You have been mentioned by " + current.user_from.name + " in <a href='/" + recordGR.getRecordClassName() + ".do?sys_id=" + recordGR.getUniqueValue() + "'>" + linkText + "</a></p>");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 07:05 AM
Here is the whole code with the Get Short Description highlighted.
var recordGR = new GlideRecord(current.table);
var field = current.field_name;
if(recordGR.get(current.document)) {
email.setSubject("You have been mentioned in " + recordGR.getDisplayValue());
template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'>You have been mentioned by " + current.user_from.name + " in <a href='/" + recordGR.getRecordClassName() + ".do?sys_id=" + recordGR.getUniqueValue() + "'>" + recordGR.getDisplayValue() + "</a> : "+recordGR.get(current.short_description) + "</a></p>" + '<br>' + 'Comments: ' + current.document[field].getJournalEntry(1));
}