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-07-2022 10:39 PM
Hi Laidda,
You will see comments and work-notes "Sample123" when you click the UI action (lines 16 and 17).
gr.comments = "Sample123";
gr.work_niotes = "Sample123";
What exactly do you want to add to comments and work-notes?
Thanks!
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 03:05 AM
we don't want to add new comments/work notes. we need to update the existing comments/work notes by adding something to the text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2022 10:48 PM
Hi
comments and work notes are stored at table sys_journal_field
If you want to update all existing work notes and comments you have to load that lists, iterate them and update each record individually.
gr.work_notes.getJournalEntry(-1); // this gives you all the entries for work notes
gr.comments.getJournalEntry(-1); // this gives you all the entries for comments
Kind regards
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2022 04:10 AM
Hi Laida,
>change 'Sample123' to 'Sample Text Change'
Not sure why the sample code is setting to "Sample123" instead of "Sample Text Change".
gr.comments = "Sample123";
gr.works_notes = "Sample123";
Anyways, to change comments and work notes, query on "sys_journal_field" instead of "incident" table.
var gr = new GlideRecord('sys_journal_field');
gr.addEncodedQuery('name=incident^element=work_notes^ORelement=comments');
gr.addQuery('element_id', current.sys_id);
gr.query();
while (gr.next()) {
gr.setValue('value', 'Sample Text Change');
gr.update();
}