File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1+ var incidentSysId = 'e9859dd4c39b2210ffd47205e401312d' ; // sys_id of the incident
2+ var userName = 'john.doe' ; // user_name of the user adding the comment
3+ var commentText = 'This is my Hacktoberfest comment via Background Script!' ; // Comment text
4+ var journalField = 'comments' ; // Can be 'comments' or 'work_notes'
5+ //var journalField='work_notes';
6+
7+ var incidentGR = new GlideRecord ( 'incident' ) ;
8+ if ( incidentGR . get ( incidentSysId ) ) {
9+ incidentGR [ journalField ] . setJournalEntry ( commentText , userName ) ;
10+ incidentGR . update ( ) ;
11+ gs . info ( 'Comment added successfully on Incident ' + incidentSysId + ' by ' + userName + '.' ) ;
12+ } else {
13+ gs . error ( 'Incident not found for sys_id: ' + incidentSysId ) ;
14+ }
You can’t perform that action at this time.
0 commit comments