How to get latest additional comments changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2020 10:16 AM
Hi experts ,
I am using below code in integration hub to get the latest additional comments in incident , however it is giving output "false" each time after updating the additional comments -
(function execute(inputs, outputs) {
outputs.cmt = inputs.incidentRecord.comments.changes();
})(inputs, outputs);
Can someone please suggest ?
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2020 10:20 AM
Hi,
Try below script
if(current.comments.changes())
{
current.description=current.comments.getJournalEntry(1);//change your field name.
if(current.work_notes.changes())
current.short_description=current.work_notes.getJournalEntry(1);//change your field name.
}
OR If above not worked then try below
var worknotes = current.work_notes.getJournalEntry(1);
var onlyNotes = worknotes.split("(Work notes)\n");
var lastWorknote = onlyNotes [1];
Thanks,
Kunal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2020 10:52 AM
Thanks for your reply.
However if additional comments changes then only I need last comments, its not working as expected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2020 11:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2020 10:34 AM
Hi
Comments is a journal field. To get the latest entry, simply use
inputs.incidentRecord.comments.getJournalEntry(1);
Mark the comment as a correct answer and helpful if this answers your question.