- 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-09-2018 11:22 AM
To be clear, there is an alternate way of approaching this. Just look up the journal entry yourself and output the value.
Example code (borrowed from https://hi.service-now.com/kb_view.do?sysparm_article=KB0529930&sysparm_topic=Known+Error+Database )
var gr = new GlideRecord('sys_journal_field');
gr.addQuery('element_id',current.sys_id);
gr.addQuery('name','task');
gr.query();
while( gr.next() ) {
gs.print( gr.element + ' = ' + gr.value );
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2019 02:50 AM
MORE SIMPLIFIED SOLUTION:-
var work_notes = current.work_notes.getJournalEntry(1)
var i = work_notes.indexOf('\n');
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-12-2020 03:24 AM
var list = current.comments.getJournalEntry(1).split('\n'); // split into list of sentences
list[0] = ''; // clear the first sentence
var text = list.join('\n'); // combine all sentences again into one single string, now without no header
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 03:44 AM
if you are using this for an outbound email like a notification or something, you might want to combine the text using join('</br>'); instead for html new line. works perfectly fine