The CreatorCon Call for Content is officially open! Get started here.

sys_journal_field - Import of work notes through Import set are showing wrong sys_created_by and sys_created_on

jan_at_te
Tera Expert

Hello,

through a System Import Set, I want to upload the sys_journal_field records for work notes on an Asset record (alm_hardware). Target: sys_journal_field.

Within the Transform Map, I set up a Transform Script with the When condition OnBefore. It just contains:

target.autoSysFields(false);

find_real_file.png

Further, I added two Field Maps targeting sys_created_by with script:

answer = (function transformEntry(source) {

 mycreatedBy = source.u_created_by;
 var createdBy = '';
 var get_user=new GlideRecord('sys_user');
 get_user.addQuery('u_te_id',mycreatedBy);
 get_user.setLimit(1);
 get_user.query();
 while(get_user.next()){
   createdBy = get_user.sys_id;
 }
 return createdBy; // return the value to be put into the target field

})(source);

and sys_created_on with script:

answer = (function transformEntry(source) {
timestamp = source.u_datum;
// Add your code here
return timestamp; // return the value to be put into the target field

})(source);

I just use the script there as I debugged the script for the date format.

My sys_journal_field records are looking as beautiful as they can:

 find_real_file.png

However, within the alm_hardware records, they show my account and the time the record was created and not the one as I loaded it.

find_real_file.png

 

Any idea why not the person and the date are showing up as it is showing within the sys_journal_field records? 

 

Thanks in advance

Jan

1 ACCEPTED SOLUTION

There are multiple tables that control the journal entries like audit, history and the journal.

You can refer this post from SN Guru to see on how you could update entries in the journals.

https://www.servicenowguru.com/system-definition/remove-activity-log-journal-entries/

View solution in original post

7 REPLIES 7

Alikutty A
Tera Sage

Hello Jan,

Have you checked the history tables? what are the values of created by and created on history? You could right click on record and check the history list.

 

It is just empty:

find_real_file.png

I meant on the Task record where you add the work notes

Of course

find_real_file.png

what is the logic behind sys_journal_field and the Work Notes. I thought that it is just a simple reference, isn't it?