Remove time stamp and user info from notification

Abinash
Kilo Contributor

Hi,

I want to remove the date & time stamp and user info from my email notification and only want the text message. I am doing it on comment field for RITM.

find_real_file.png

Kindly help me to fix this

Thanks in advance

1 ACCEPTED SOLUTION

Your mail script would look something like this. Note, this is not a drop-in solution. You should understand what it does and make appropriate modifications for your table, field, and desired results.



var comment = current.comments.getJournalEntry(1);


var dateRE = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*\n/;


template.print(comment.replace(dateRE, ''));


View solution in original post

18 REPLIES 18

Chuck Tomasi
Tera Patron

You would have to do this yourself via mail script.



You can get the latest journal entry via the getJournalEntry(1) method: example:



inc.comments.getJournalEntry(1)



and then you can use a regular expression to strip out the date/time/name to get just the text.



Scripting for Email Notifications - ServiceNow Wiki


Email Notifications - ServiceNow Wiki


Thanks chuck... but can u plz show me sample kind of mail script for achieving this requirement... which doesnt contains the time stamp and user info


Your mail script would look something like this. Note, this is not a drop-in solution. You should understand what it does and make appropriate modifications for your table, field, and desired results.



var comment = current.comments.getJournalEntry(1);


var dateRE = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*\n/;


template.print(comment.replace(dateRE, ''));


Hi Chuck!



Found this thread and thought it could be the answer to my problem. But it is not working for me.



I have the following UI Action script:


ui action script.PNG


With the following outcome:


worknote.PNG


As you see I want to remove the timestamp and user info from work notes. How do I do that?