How to move the approval /rejection status to work notes in ritm

jobin1
Tera Expert

Hi All

 

In ritm form is some one is approved or rejected the approval then the same message has to be updated in work notes as well, How we can achieve this?

find_real_file.png

1 ACCEPTED SOLUTION

@jobin 

No No. Please see my updated comment . I am posting it again with details which you need to try:

BR Details:

Table name: sysapproval_approver

When: After Update

Condition: Comments Changes

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.comments.getJournalEntry(1);
		gr.update();
	}

})(current, previous);

BR:

find_real_file.png

Result:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

11 REPLIES 11

@shloke04  when I use before br it is showing best practice exception and it is not allowing me to save the form

@jobin 

No No. Please see my updated comment . I am posting it again with details which you need to try:

BR Details:

Table name: sysapproval_approver

When: After Update

Condition: Comments Changes

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.comments.getJournalEntry(1);
		gr.update();
	}

})(current, previous);

BR:

find_real_file.png

Result:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke