Specify timestamp and user ID on Journal Entries

roshanrao
Kilo Expert

Hi All,

We are developing a custom application that manages cases. This application replaces a system that the customer is using.

Their existing system currently has case notes, which would typically be modeled as journal entries in ServiceNow. The ask is to bring in these notes (along with timestamp and user ID) into ServiceNow at cutover. Is there any way to have these created so that the fields match the legacy system?

Adding the values from the legacy system in the note text would be a fall back, but may be confusing to users.

Thoughts?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

You may be able to do it by importing the entries in to sys_journal_entry after you've already created the parent record (incident, problem, etc.) I haven't done this directly, but that's the table where the journal entries are stored so that's where I'd start.


View solution in original post

5 REPLIES 5

Chuck Tomasi
Tera Patron

You may be able to do it by importing the entries in to sys_journal_entry after you've already created the parent record (incident, problem, etc.) I haven't done this directly, but that's the table where the journal entries are stored so that's where I'd start.


antin_s
ServiceNow Employee
ServiceNow Employee

Hi Roshan,



Also, if you are planning to do through a script, you can use autoSysFields(false) to keep the same values for fields like sys_created_on, sys_created_by ...etc



'autoSysFields' is used to disable the update of 'sys' fields (Updated, Created, etc.) for a particular update. This really is only used in special situations. The primary example is when you need to perform a mass update of records to true up some of the data but want to retain the original update timestamps, etc.



//Change the category of all 'software' incidents to 'hardware' without updating sys fields


var gr = new GlideRecord('incident');


gr.addQuery('category', 'software');


gr.query();


while(gr.next()){


    gr.category = 'hardware';


    gr.autoSysFields(false);


    gr.update();


}



https://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/



Hope this helps. Mark the answer as correct/helpful based on impact.
Thanks
Antin

Hi Antin,


Though the cheat sheet is helpful, the post is off topic. The question is around how I could populate journal fields with a predetermined time / user info on data load.



Thanks for the reply.


He's not that far off topic if you take in the account that records in sys_journal_field are based on the time the record was created (sys_created_on). If you have "massage" that field manually, then you are going to need the autoSysFields(false) method to keep the system from setting it for your to the current time when the record is imported.