For the Activity Stream @Mention Email notification, include the text of the comment

kluces
Kilo Contributor

My customers see value in including the text where they were "@mention" in the Activity Stream @Mention Email notification. This way they will not have to login to our instance to view the comment.

I don't what the entire Activity stream, just the entry where they were mentioned into the Activity Stream @Mention Email notification.

Thanks in advance.find_real_file.png

1 ACCEPTED SOLUTION

sachin_namjoshi
Kilo Patron
Kilo Patron

Activity steam  notifications are implemented in below notificatiion

find_real_file.png

and this notifications calls email script $ng_activity_mention_body

You will have to update ng_activity_mention_body email script to include comments like below

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 + "with comments as " +  recordGR.comments.getJournalEntry(1) + " in <a href='/" + recordGR.getRecordClassName() + ".do?sys_id=" + recordGR.getUniqueValue() + "'>" + linkText + "</a></p>");
}

find_real_file.png

View solution in original post

7 REPLIES 7

sachin_namjoshi
Kilo Patron
Kilo Patron

Activity steam  notifications are implemented in below notificatiion

find_real_file.png

and this notifications calls email script $ng_activity_mention_body

You will have to update ng_activity_mention_body email script to include comments like below

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 + "with comments as " +  recordGR.comments.getJournalEntry(1) + " in <a href='/" + recordGR.getRecordClassName() + ".do?sys_id=" + recordGR.getUniqueValue() + "'>" + linkText + "</a></p>");
}

find_real_file.png

Hello Sachin,

I was wondering if there is a way we can record the email sent via Mentions in the activity streams of the records (incident, requests, story, etc) like other emails gets recorded.

 

Regards,

Amit

Hi Sachin,

Is there a way that If assignee mentions another person on HR case/task work note by using (@name of person to be mentioned), an email notification is triggered but is there a way where mentioned person can see somewhere in ServiceNow that where all he has been mentioned. So that he doesn't need to go through his mails to follow the mentions.

Thanks!!

Hi @sachin_namjoshi 
What if I Want to implement same functionality on another table(not on live_notification table) notification.?
can we fetch same data on that ?