Notification, how to take last comment or work note
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2017 10:47 AM
My requirement is to take last comment or work note ,which one last updated either additional comment or worknotes . how to do that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2017 10:56 AM
Hi,
From which context are you accessing work note/comment? You can try this out from a notification mail script or business rule
var worknote = current.work_notes.getJournalEntry(1);
var worknoteContent = worknote.split("(Work notes)\n");
var lastWorknote = worknoteContent[1];
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2017 11:01 AM
you can use getJournalEntry(1) will get only the latest entry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2017 11:17 AM
My requirement is little bit different .. if anyone update either work note or additional comment .... i have to take that as a comment on notifications....
For example if additional comment updated in last .. then it only slow last additional comment .. if worknote updated then worknote .. if noone updated then not showing anyone

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2017 11:22 AM
Yes your notificarion conditions should be work notes changes or additional
comments changes. Then in email script use this
if(current.comments.changes())
template.print(current.comments.getJournalEntry(1));
else
template.print(current.work_notes.getJournalEntry(1));
On Mon, Feb 20, 2017 at 13:17 ankit_gupta <community-no-reply@servicenow.com>