- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2025 10:17 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2025 10:35 PM
Try below script. It'll exclude the timestamps.
var rec = new GlideRecord('incident');
rec.get('1682fd87378c1300023d57d543990e2e');
var wrk = rec.work_notes.getJournalEntry(1).toString();
var work_cmts = wrk.split('(Work notes)\n')[1]; // This line will give you only the work notes.
gs.info(work_cmts );
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2025 10:51 PM
so basically you only want the notes and not the user and date/time
if yes then do this
var dateRE = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*\n/;
var currentWN = current.work_notes.getJournalEntry(1);
currentWN = currentWN.replace(dateRE, '');
gs.info(currentWN);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2025 10:55 PM
@VijayKummamuru - Just you need to add the .split("(Work notes)\n")[1] to get only the work notes added to the ticket.
var currentWN = current.work_notes.getJournalEntry(1).split("(Work notes)\n")[1];
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 12:36 AM
Hello @VijayKummamuru
var workNotes = current.work_notes.getJournalEntry(1).split("(Work notes)\n")[1];
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2025 10:35 PM
Try below script. It'll exclude the timestamps.
var rec = new GlideRecord('incident');
rec.get('1682fd87378c1300023d57d543990e2e');
var wrk = rec.work_notes.getJournalEntry(1).toString();
var work_cmts = wrk.split('(Work notes)\n')[1]; // This line will give you only the work notes.
gs.info(work_cmts );
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2025 10:51 PM
so basically you only want the notes and not the user and date/time
if yes then do this
var dateRE = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*\n/;
var currentWN = current.work_notes.getJournalEntry(1);
currentWN = currentWN.replace(dateRE, '');
gs.info(currentWN);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 10:26 PM
Thank you for marking my response as helpful.
As per new community feature you can mark multiple responses as correct.
If my response helped please mark it correct as well so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2025 10:55 PM
@VijayKummamuru - Just you need to add the .split("(Work notes)\n")[1] to get only the work notes added to the ticket.
var currentWN = current.work_notes.getJournalEntry(1).split("(Work notes)\n")[1];
Thanks & Regards,
Vasanth