How to check Work Notes has been updated or changed in server side

ajayr
Giga Expert

Hello Guys,

I have a requirement where I need to send the WorkNotes of Incident from Snow to Remedy.

I am using getJournalEntry(1) to get the last updated work notes and send it to Remedy, till that it is fine.

Now if the WorkNotes is not updated still getJournalEntry(1) will send the same last updated work notes to Remedy, thus making duplicate entries in Remedy.

I wanted to know, How can we check whether WorkNotes has been updated or not. If there is no worknotes then nothing should be sent to Remedy.

FYI: I used current.work_notes.changes(), but that didn't work

14 REPLIES 14

dannylake1
Mega Contributor

Hello, I had a requirement to grab the latest Comments or Work Notes only if they are NEW. You can use a script (ex in a Business Rule) to determine whether there has been a change to these fields, example below:

var newWorkNotes;
var newComments;

//get newly added worknotes
if(current.work_notes.changes()){
newWorkNotes = current.work_notes.getJournalEntry(1);
}

//get newly added comments
if(current.comments.changes()){
newComments = current.comments.getJournalEntry(1);
}

 

Hope this helps,

Danny

Hi Danny,
This helped me out perfectly! Thankyou! 

If my answer has helped with your question, please mark it as correct and helpful.

Kr!
Robin

Snehal2
Kilo Guru

Hi,

The best way is to use BR. You can give the condition as shown below:find_real_file.png

Regards,

Snehal

Hi Snehal,

This didn't help out for me as I wanted this working on 'comments' and that is not available in the dropdown for me. Setting it to 'additional comments' doesn't work. 

If my answer has helped with your question, please mark it as correct and helpful.

Kr!
Robin

Hi Robin,

On which table you tried creating this BR? Is there no additional comments/worknotes available on the table you tried?