We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5918982 commit 8ec5d9bCopy full SHA for 8ec5d9b
1 file changed
Server-Side Components/Background Scripts/Add Comments/Add_Comments_Script.js
@@ -0,0 +1,14 @@
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
+ }
0 commit comments