Notification, how to take last comment or work note

ankit_gupta1
Tera Expert

My requirement is to take last comment or work note ,which one last updated either additional comment or worknotes . how to do that.

ctomasi

16 REPLIES 16

MichaelRauch
Giga Guru

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


if(comment > workNotes){
template.print(comment.replace(dateRE, ''));
}
else{
template.print(workNotes.replace(dateRE, ''));
}

The Journal Entry leads with a date/time. This compares the beginning date and time and outputs whichever is the newest.

Hi,

I need help on one of the scenarios:

1. When the "caller" sends reply to the email then the "Additional comments" should be updated on the Incident

2. When the "assigned_to" is replying then the "work-notes" should be updated 

In the above 2 scenarios i tried the below code:

if (email.from == current.caller_id.email){

gr.comments = email.body_text;
}

if (email.from == current.assigned_to.email)
{
gr.work_notes = email.body_text;
}

However the additional comments gets updated with email body text with the fact that it updates the entire email chain. Is there a way that I can update work notes or comments with latest email reply content? For example : if I have

Body :

"Test 4 

from:xyz

date: abcabcabc

to:aghgh

...

..

Test 3

I would like to update the notes or comments with "Test 4" accordingly