How to update comments or work notes in incidents in UI Action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2022 10:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 03:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2022 05:33 AM
I think you have the answers you need, but to be clear... the comments and work_notes fields on the incident GlideRecord are only there for input. Once you save the record, the content is moved into a new record in the sys_journal_field table. So any changes to existing records need to be made there. Any NEW comments that you want to add can be made to the Incident GlideRecord fields.
To update the existing entries for a specific record, you need to query the sys_journal_field table where element_id field on the journal entry matches the sys_id of the incident record. As a side note, once you have the incident as current, you do not need to query the database for the record.
var grEntry = new GlideRecord( 'sys_journal_field' );
grEntry.addQuery( 'element_id', current.getUniqueValue() );
grEntry.query();
while( grEntry.next() ){
grEntry.value = 'whatever you want the new entry to say';
grEntry.update();
}