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
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!


FANTASTIC!   Thank you so much for sharing this!


Jason,





I believe you may share the solution of Laura into your today's thread: Display Text in Activity Stream @Mention Email Notification so others interested may see it and use it + with this action you may directly close the topic




Best Regards,


Georgi Mavrodiev



IT Consultant


Do IT Wise



You may visit us in our Web Site: www.doitwise.com


Laura, Thank You! Excellent solution!


Thank you, Georgi for your input, also:)