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

This is what i tried from background script.

var incident = new GlideRecord('incident');
incident.get('a3572d2b6f3bb60017fb107abb3ee4eb');
incident.comments.setJournalEntry('this is a comment','admin');
incident.update();

and below is the result.

find_real_file.png

 


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

Are you logged in as admin when you do that, or as a user with admin access?

Bj_rn G
Giga Contributor

I'm trying to run this as a non-privileged user (an integration account) instead of from an admin account.

Yes i logged in as admin account to run the script.


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

Bj_rn G
Giga Contributor

So the real question is, what role do you need in order for this second field to work? It works for admin accounts, but not for a non-privileged account.