- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 05:12 AM
Hi All
I'm creating incidents via REST and i want the comments added to be listed as added by the person, not the web service user used in the integration.
I've tried gliding into the sys_journal_field table and inserting a new record with all the details i want but this doesn't work, comment is added the the author is still me.
function addComment(record,caller,comments){
var gr = new GlideRecord('sys_journal_field');
gr.initialize();
gr.name = 'incident';
gr.element = 'comments';
gr.element_id = record;
gr.sys_created_on = gs.nowDateTime();
gr.sys_created_by = caller;
gr.value = comments;
gr.insert();
}
I've also tried setJournalEntry() but i get the same result:
gr['comments'].setJournalEntry(comments,caller.name);
Is there a way of doing this? I feel like setJournalEntry should work since it literally says that's how it works on the developer site but it doesn't, which is annoying.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 06:16 AM
Hello David
Maybe this can help you. Impersonate like another user and put the comment
var gr = new GlideRecord("incident");
gr.addQuery("number", "<<incNumber>>");
gr.query();
if (gr.next()) {
var myUser = gs.getUserDisplayName();
var UserSysId = '45365ed5dbfe2600b1ff73200f961967';
var impUser = new GlideImpersonate();
impUser.impersonate(UserSysId);
gr.comments = ' - Another user comment';
gr.update();
}
You can modify this script to update the journal
Please, mark correct, useful or bookmark if I helped you
Thanks
Ariel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 06:16 AM
Hello David
Maybe this can help you. Impersonate like another user and put the comment
var gr = new GlideRecord("incident");
gr.addQuery("number", "<<incNumber>>");
gr.query();
if (gr.next()) {
var myUser = gs.getUserDisplayName();
var UserSysId = '45365ed5dbfe2600b1ff73200f961967';
var impUser = new GlideImpersonate();
impUser.impersonate(UserSysId);
gr.comments = ' - Another user comment';
gr.update();
}
You can modify this script to update the journal
Please, mark correct, useful or bookmark if I helped you
Thanks
Ariel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 06:43 AM
Thanks Ariel that works really nicely! It puts the caller in as all the other system fields on the form as well which is a nice little bonus 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 06:46 AM
Hi David
Thank you ... It's an honor for me to help you.
Ariel