Change Mail_Script to Display "@Mentions"

codechaser
Giga Expert

I am looking for a way to change the existing mail_script API ${mail_script:ng_activity_mention_body} to display the @Mentions from work notes, instead of just the link to view messages in an incident.


-Thx!

1 ACCEPTED SOLUTION

laurac
Tera Expert

See in bold below how we edited the ng_activity_mention_body to accomplish this.   We also edited the subject of the emails above.



var recordGR = new GlideRecord(current.table);


if(recordGR.get(current.document)) {


        email.setSubject("You have been mentioned in " + recordGR.number +" | " + 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 />");


      }


}



Code thanks to Mike Kaufman!


View solution in original post

10 REPLIES 10

laurac, can you please help me understand the purpose of displaying both the number and the display value in the subject line ? Thanks.