Inserting just the last 'Additional comment' into e-mail notifications?

jas101
Tera Expert

Hi guys,

 

Can someone please shed light on the best way to insert the most recent 'Additional comment' into a e-mail notification.

 

We have just inserted ${comments} in our 'Incident commented' e-mail notification as there was a request for users to see updates made to records via inbound e-mail replies - however now all e-mail replies within the ticket are showing in the e-mail notification which is making it unnecessarily long.

 

This has just reminded me of another issue with notifications - confidentiality/privacy notices at the bottom of e-mails! Is there an easy way to strip these out so they are not placed into the record?

 

Cheers in advance,

Daniel

1 ACCEPTED SOLUTION

marcguy
ServiceNow Employee
ServiceNow Employee

System property:


Using Journal Fields - ServiceNow Wiki



or for only selected:


GlideElement - ServiceNow Wiki



current.comments.getJournalEntry(1); //get last comment


View solution in original post

9 REPLIES 9

Thanks but having tested with: \n\n-----Original Message-----,\n\n   _____   \n\n From:




I'm now expecting SN to ignore everything other than the text in my e-mail reply but it is not still.




A standard header looks like like this so why isn't everything below 'From:' being discarded?




From: Singer, Daniel
Sent: 09 September 2014 15:35


To: 'IT Service Desk - DEV'
Subject: RE: INC0204111 -- comments added to New incident


Hi Daniel,



can you elaborate a little?


-Anurag

When a user replies to a notification sent via SN, this reply will be entered into the record under 'Additional comments'.



However what is also included is the e-mail disclaimer/confidentiality notice etc. on that e-mail reply which does not need to go in to the record (it just clogs the Activity history section up unnecessarily).



I am trying to stop this from going into the record - ideally it would only be the text in the e-mail reply that goes into the record and nothing else.



Thanks,


Daniel


Hi Daniel,



I can suggest you to do the string operations as below.



var str=email.body_text;


var count=str.indexOf('From:');


var str_text=str.substring(0,count-1);



then you can update the additional comments with str_text.



Let me know if it works.


Yaraslau
Tera Guru

Try ${comments:1} or ${comments:2} or ...