
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 05:05 AM
Use case - we need to know the timestamp when support user posted the comments in work notes. we may have multiple comments so I want to understand how we can capture the timestamp for multiple comments through script.
I know we can store the timestamp in custom field through BR but thats not what I am looking for.
Regards
Sulabh Garg
Solved! Go to Solution.
- Labels:
-
Task Communications Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 05:24 AM
All comments are stored in the sys_journal_field table. You can get the timestamp from this table.
Go to the table "sys_journal_field"
Filter on:
Name = "the table the comments belong to, eg. incident"
Element = "comments"
Element Id = "The sys_id of the record that you wish to get the comments for"
The use the "sys_created_on" field as the timestamp for when the comment was created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 05:24 AM
All comments are stored in the sys_journal_field table. You can get the timestamp from this table.
Go to the table "sys_journal_field"
Filter on:
Name = "the table the comments belong to, eg. incident"
Element = "comments"
Element Id = "The sys_id of the record that you wish to get the comments for"
The use the "sys_created_on" field as the timestamp for when the comment was created.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 06:01 AM
Hello Sulabh,
AS Lasse already mentioned, you can get the created date from sys_journal_field table.
using script, when you use getJournalEntry, it gives you the timestamp along with the comment.
gr.work_notes.getJournalEntry(),
or
gr.comments.getJournalEntry()
Mark the comment as a correct answer and helpful if this has answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 07:16 AM
Something like this?
gs.print(current.work_notes.getJournalEntry(1).split(' ')[0]+' ' +current.work_notes.getJournalEntry(1).split(' ')[1]);
*** Script: 2020-12-22 09:04:29
Here is the breakdown of that
var lastWorkNote = current.work_notes.getJournalEntry(1).split(' '); //Split the string at the spaces. Now you have an array (comma separated list) you can join pieces together by index ([0], [1], etc.)
gs.print("lastWorkNote: " +lastWorkNote); //This is what it looks like now.
var timestamp = lastWorkNote[0] + ' ' +lastWorkNote[1]; //Now we can build the time stamp by taking [0] (date), adding a space, then taking [1] (time).
gs.print("Timestamp: " +timestamp);
This is what we started with:
*** Script: 2020-12-22 09:04:29 - FirstName LastName (Work notes) I'm some work notes from a record!
Wheeee!
And this is after the split:
*** Script: lastWorkNote: 2020-12-22,09:04:29,-,FirstName,LastName,(Work,notes)
I'm,some,work,notes,from,a,record! Wheeee!
And finally after we piece the timestamp back together:
*** Script: Timestamp: 2020-12-22 09:04:29