how to add comments made while rejecting the approval in RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2023 12:03 PM
When a request is rejected by the approver, he/she put a comment/reason as to why this request was rejected. i want to copy that comment and paste it to the RITM so that the requestor should know why their request was rejected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2023 04:23 PM
Hi @Vijayenthiran S ,
You can easily fulfil your requirement by writing a after BR on sysapproval_approver table.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2023 05:51 PM
Hi,
You can try BR on sysapproval_approver table
(function executeRule(current, previous /*, displayValue, etc.*/) {
// Check if the approval task was rejected
if (current.state == 3 /*Rejected*/) {
var rejectionComment = current.comments.getJournalEntry(-1); // Get the latest comment
// Get the corresponding RITM
var ritmGR = new GlideRecord('sc_req_item');
if (ritmGR.get('sys_id', current.sysapproval)) {
// Update the RITM with the rejection comment
ritmGR.comments = "Rejection Comment: " + rejectionComment;
ritmGR.update();
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2023 01:00 PM - edited ‎08-23-2023 02:09 PM
Thanks for your response.
I tried your answer but it does not seem to working. Please assist. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2023 01:07 PM
  Hi Chaitanya,
Thanks for your response. However, this doesn't seem to be working. Please let me know if something is wrong. Thanks a ton.