Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to add approval comments in its Parent task?

Naveen Kumar
Tera Contributor

We have this approval record.

When users adds comments in the approval record, -->This should update the Parent(Approval for) record.

Like it should be logged in Parent record.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use after update BR on sysapproval_approver table

Condition: Comments Changes

Script: Something like this; Enhance it further

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord(current.source_table);
	gr.addQuery("sys_id", current.document_id);
	gr.query();
	if (gr.next()) {
		gr.comments = current.comments.getJournalEntry(1);
		gr.update();
	}

})(current, previous);

regards
Ankur

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use after update BR on sysapproval_approver table

Condition: Comments Changes

Script: Something like this; Enhance it further

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord(current.source_table);
	gr.addQuery("sys_id", current.document_id);
	gr.query();
	if (gr.next()) {
		gr.comments = current.comments.getJournalEntry(1);
		gr.update();
	}

})(current, previous);

regards
Ankur

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

Hi,

So, there is no OOB Business rule doing that.

We have to write one custom Business rule for this?