- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2023 05:11 AM
Hi,
How can I insert a comment into additional comments on incident table using script, i tried with this script but I had no luck:
var gr = new GlideRecord('incident');
gr.addEncodedQuery('sys_id=422122f79dc1311020d2b7cbb48c1914');
gr.query();
if(gr.next()){
gr.comments.setJournalEntry('Please reopen this incident.');
gr.upadte();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2023 07:43 AM
You can try the following:
var comInc = new GlideRecord('incident');
comInc.get('422122f79dc1311020d2b7cbb48c1914');
comInc.query();
while(comInc.next()) {
comInc.comments = "Please reopen this incident.";
comInc.update();
}
The setJournalEntry is add additional attributes to the comment, you can find more info on it here: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0748347
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2023 08:42 AM
Hi @Alon Grod
Please find the Script below.
Script :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 12:07 AM
Hello @Alon Grod ,
You can directly add message to Default Value related after configuring the field.
Please mark my solution as Helpful/Correct, if applicable.
Thanks & Regards,
Chaitali Vale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 10:20 AM
Just to add if you're using Before BR, don't use current.update();. It may lead to recursive calls and cause performance issues.