Approval / Rejected status on Comments /work_Notes in RITM

akin9
Tera Contributor

Hello All,

We want to update Approval / Rejected status on Comments /work_Notes in RITM.

Eg .

If the Request is approved/rejected by the approver. 

Your Request has been Approval / Rejected by Abel tutor (approver Name) 

 

akin9_0-1669613411756.png

 

How can we achieve this please support.

 

Thank you

 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @akin9 ,

You can write an after BR on approval table (sysapproval_approver)

 

bhavaniy_0-1669618636757.png

 

bhavaniy_1-1669618659894.png

 

bhavaniy_0-1669619028206.png

 

Please mark my response as helpful/correct if this helps

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@akin9 

you can use after update BR on sysapproval_approver

Condition: (current.state == 'approved' || current.state == 'rejected') && current.source_table == 'sc_req_item'

Script:

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

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

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@akin9 

Did you get a chance to check on my above response?

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

Hello @Ankur Bawiskar 

Thank you for your quick reply,

I have Used the above your script unfortunately not working for me.

Requirment is Once RITM is Approval / Rejected below comments need to be auto populate.

Your Request has been Approval / Rejected by Abel tutor (approver Name) 

 

Please check the below pls correct me what i missed here.

 

akin9_0-1669618759481.png

akin9_1-1669618787054.png

 

 

Thank you!

Community Alums
Not applicable

Hi @akin9 

 

Try this:

 

var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.document_id);
gr.query();
if(gr.next()){
gr.work_notes = 'Your request has been '+ current.state + ' by ' +current.approver.name;
gr.update();
}

@akin9 

script shared by me should work fine.

you could have debugged and enhanced it further.

can you share what did you write and what didn't work

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