- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2012 10:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2012 01:36 AM
OK. Answrting myself:
var work_notes = current.work_notes.getJournalEntry(1)
var regex= new RegExp('\n'); // searching for the first line break
var work_notes2=work_notes;
var i = work_notes.search(regex);
if (i>0)
{
// taking everything after the first line break, he-he.
work_notes2 = work_notes.substring(i+1, work_notes.length);
}
gs.log('pure work notes:'+work_notes2);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2012 01:36 AM
OK. Answrting myself:
var work_notes = current.work_notes.getJournalEntry(1)
var regex= new RegExp('\n'); // searching for the first line break
var work_notes2=work_notes;
var i = work_notes.search(regex);
if (i>0)
{
// taking everything after the first line break, he-he.
work_notes2 = work_notes.substring(i+1, work_notes.length);
}
gs.log('pure work notes:'+work_notes2);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2013 04:57 PM
Thanks this worked like a charm for us!
We were able to fix this on the "Post Knoweldge" action for a problem (the workaround text from OOB simply looked horrible).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2012 06:35 AM
as you've seen, it's just a string that you get back.
there's no API to separately retrieve the individual entries, line by line with just the value. There's not even an undocumented way, the contents are inaccessible.
your approach seems to be the only option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2012 02:16 AM
Thanks Nikita,
I've just used your regex script for our email templates.
It should really be easier to pull out the latest comments. Maybe ServiceNow will update this in a future release.
I've created a script includes which does a 'template.print' of the cleaned comments for use in email templates / notifications.
Paul