Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Rejection comments are not attaching in the email notification

Sriram Pusuluri
Tera Contributor

Hi Team,

 

Rejection comments are not attaching in the email notification for Requested Items

 

 

SriramPusuluri_0-1776947212295.png

Approver has added Rejected comments, but it is not showing here

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@Sriram Pusuluri 

this works OOTB if comments are available

55.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar  I have checked with OOTB, notification Rejected comments are added in RITM approval comments, but those are not coming in the Notification

@Sriram Pusuluri 

so rejection comments are not coming for any rejection happened?

not for CHG etc?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Kilo Patron

Hi @Sriram Pusuluri 

 

AS Per KB KB0786276 Reject comments not displayed in email notification for Knowledge article or any table rec... 

 

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

[Most Probable Cause:


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
Check your filter according to your business needs. As This is a customisation, we cannot exactly how it show work but it seems to me that you can add possibly the condition to exclude "No Longer required" approvals:

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.
var pd = new GlideRecord('sysapproval_approver');
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
Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: