- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 05:45 AM - edited ‎12-07-2023 05:45 AM
When the Change Request moves from Authorize to Scheduled state then Approval gets generated, if we reject the approval then the incident work notes must get updated that the 'Change has been rejected for the incident'. Please help me to figure out this
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 07:43 AM
There is definitely an extra } there, try this:
(function executeRule(current, previous /* previous state */) {
var incidentGR = new GlideRecord('incident');
if (incidentGR.get('rfc', current.sys_id)) {
// Update incident work notes
incidentGR.work_notes = 'Change request has been rejected: ' + current.number;
// Here you can also add a status change maybe
incidentGR.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 07:19 AM
Hi,
Getting this error...and if i remove parenthesis then the work note is appearing multiple times in a loop

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 07:43 AM
There is definitely an extra } there, try this:
(function executeRule(current, previous /* previous state */) {
var incidentGR = new GlideRecord('incident');
if (incidentGR.get('rfc', current.sys_id)) {
// Update incident work notes
incidentGR.work_notes = 'Change request has been rejected: ' + current.number;
// Here you can also add a status change maybe
incidentGR.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 07:48 AM
Again the worknotes are getting multiple times

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 07:51 AM
Can you share more screenshots? From your condition and the work notes being inserted. I'm afraid that there are other rules overlaping.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 08:04 AM