can we show the tagged comment in the notification - "Activity Stream @Mention Email"

gayatri38
Giga Guru

So in the OOB Notification - "Activity Stream @Mention Email" it shows as 

gayatri38_0-1709292200579.png

 Now the requirement is, in this email can we include and show the comment that is tagged in ?

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @gayatri38 ,

Navigate to System Notification>Email> notification Email Scripts

SandeepDutta_0-1709296983206.png

 

open the ng_activity_mention_body email script :

Update the script to something similar to this

var recordGR = new GlideRecord(current.table);
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></p>");
	if (current.field_name == "comments") {
		template.print(recordGR.comments.getJournalEntry(1) +  "<br />");
	}
	else if (current.field_name == "work_notes") {
		template.print(recordGR.work_notes.getJournalEntry(1) +  "<br />");
	}
}

View solution in original post

3 REPLIES 3

Mark Manders
Mega Patron

Something like this: https://www.servicenow.com/community/developer-forum/change-mail-script-to-display-quot-mentions-quo...?


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Community Alums
Not applicable

Hi @gayatri38 ,

Navigate to System Notification>Email> notification Email Scripts

SandeepDutta_0-1709296983206.png

 

open the ng_activity_mention_body email script :

Update the script to something similar to this

var recordGR = new GlideRecord(current.table);
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></p>");
	if (current.field_name == "comments") {
		template.print(recordGR.comments.getJournalEntry(1) +  "<br />");
	}
	else if (current.field_name == "work_notes") {
		template.print(recordGR.work_notes.getJournalEntry(1) +  "<br />");
	}
}

Thanks Sandeep, It worked fine , so just a quick question is there a way to put down the entire comments history if required in this acitivity stream email?