Rejection comments are not attaching in the email notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hi Team,
Rejection comments are not attaching in the email notification for Requested Items
Approver has added Rejected comments, but it is not showing here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
this works OOTB if comments are available
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
@Ankur Bawiskar I have checked with OOTB, notification Rejected comments are added in RITM approval comments, but those are not coming in the Notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
so rejection comments are not coming for any rejection happened?
not for CHG etc?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Issue
When a request is submitted for approval and once is approved at first and then it goes to 2nd level approval and when the 2nd level approver rejects the target record the email is triggered but the rejection comments are unavailable to be included in the notification. This works fine when the first level approver rejects the article.
Resolution
The filter of the notification script does not seem correct as it is returning many records and using the first one which could be a random record:
Solution
You can test as a background script to make sure it will work. Additionally, remember that if the notification depends on an event, it has to be triggered not before the rejection.
pd.addQuery('source_table', 'kb_knowledge'); //kb_knowledge could be replaced by any table
pd.addQuery('document_id',"SYS_ID_OF_THE_REJECTED_RECORD");
pd.addQuery('state','rejected');
pd.orderByDesc('sys_updated_on');
pd.query();
if(pd.next()) {
var notes = pd.comments.getJournalEntry(-1);
var na = notes.split("\n\n"); //stores each entry into an array of strings
for (var i = 0; i < na.length; i++) {
gs.print(na[1]);
}
}
Recommendation:
Always check in sub-production instances to validate if that the filter is correct, test different scenarios before moving into production. You can use background scripts as stated before
