setJournalEntry() ignores userName parameter?

Bj_rn G
Giga Contributor

Has anyone gotten the userName parameter to work on setJournalEntry? Specifically for a non-privileged account, i.e. not 'admin' or a user with the 'admin' role?

When I try to set a journal entry on a GlideRecord, e.g.

incident.comments.setJournalEntry('this is a comment','bjorn');

incident.update();

the comments get the journal entry, but the second parameter, username, is ignored. I've tried different variations on this, to no avail.

According to the documentation this the right way to add a journal entry, but the docs don't specify what a valid 'userName' value might look like. Is there additional documentation that specifies the right way to do this? Or does the username simply not work?

https://docs.servicenow.com/bundle/madrid-application-development/page/app-store/dev_portal/API_refe...

1 ACCEPTED SOLUTION

OOB there is ACL on sys_journal_field. please take a look at below

https://YourInstanceName.service-now.com/nav_to.do?uri=%2Fpersonalize_all.do%3Fsysparm_rules_table%3Dsys_journal_field%26sysparm_rules_label%3Dsys_journal_field


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

View solution in original post

14 REPLIES 14

Jaspal Singh
Mega Patron
Mega Patron

Hi,

 

UserName should be the User ID(user_name) field from the User (sys_user) table.

You mean the sys_user.user_name (label: User ID) right?

That doesn't work for me, can you provide an example of how you'd call it?

Prateek kumar
Mega Sage

It has to be the user_name attribute from the table.

find_real_file.png


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

That doesn't work for me, can you provide an example of how you'd call it?