How can I get the "Activity Stream @Mention Email" notification email to include the text of the @Mention?

bostonsnow
Kilo Guru

Hello all,

How can I get the "Activity Stream @Mention Email" notification email to include the text of the @Mention?

Thanks!

Mike

5 REPLIES 5

Jaspal Singh
Mega Patron
Mega Patron

Hi Michael,



You can add


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 />");


      }


}


to the mail notification script: ng_activity_mention_body


Hello Jaspal,

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).

 

Regards,

Amit

BigMikeyVegas
Tera Guru

This script worked well for me.

 

Go to System Notifications > Email > Notification Mail Script

Look for ng_activity_mention_body

Then replace the script with the following :

 

 

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></p>" + '<br><br>' + 'Comments: ' + current.document[field].getJournalEntry(1));

}

 

 

This is the result:

find_real_file.png

 

Hi,

This code is working fine.

But is there any option to put the comment entered in next line. Can we get the comment  after we mention the name from the getJournalEntry() ? In below image, we can see users are directly entering the comment after @mention so that mail is looks like this.

find_real_file.png