We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Journal field value author

Konstantin11
Kilo Guru

Hi! setJournalEntry allows us to define author as a second parameter, but that doesn't seem to update sys_journal_field record, and getJournalEntry returns the actual user who did an update.
Does anybody know if it is possible to get to the value I see in the record where the comment/work note is (in server side script)?

5 REPLIES 5

vermaamit16
Kilo Patron

Hi @Konstantin11 

 

Can you please have a look on the below post. This behavior is being controlled by an OOB ACL which could be found on https://YourInstanceName.service-now.com/nav_to.do?uri=%2Fpersonalize_all.do%3Fsysparm_rules_table%3...

 

You can try using an admin account to fetch the user who did an update and see if it works.

 

Thanks & Regards

Amit Verma

Thanks and Regards
Amit Verma

Hi, I checked the ACLs, but I don't seem to get your advice. Did you try it? Which ACL do you mean exactly?

Just to get it clear, I don't need the sys_created_by value on sys_journal_field, but a value in the actual work note, if it is different from the sys_created_by value on sys_journal_field. 

Konstantin11_0-1704892368981.png

 

Hi @Konstantin11 

 

Can you please check if the below logic works from Background scripts :

 

var je = new GlideRecord('sys_journal_field');
je.addQuery('element','work_notes');
je.addQuery('element_id', 'sys_id of your target record' );
je.orderBy('sys_created_on','ASC');
je.setLimit(1)
je.query();
if(je.next()){
 gs.info('First comment: ' + je.value.toString()+' Updated By: '+je.sys_created_by);
}

 

AmitVerma_0-1704893663417.png

 

AmitVerma_1-1704893687321.png

 

I am able to get the right created by on a particular worknote with this.

 

Thanks & Regards

Amit Verma

Thanks and Regards
Amit Verma

Try following:
1. update your record in bg script like: current.work_notes.setJournalEntry("the worknote value", "abel.tuter");
2. Do the magic and get "abel.tuter" from script and not your name or id