script to get approval rejection comment from sysapproval_approver table , in flow editor.

surajjha
Tera Contributor

Dear community leaders,

I have a custom record producer where i am using Flow designer for approval and rejection.

In case of rejection , comment is mandatory and same has to be reflect in my record producer.

I am using below script in my flow designer but not working, please help:


var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('sysapproval',current.sys_id);
apv.addQuery('comments','!=',''); // add this to only find approvals that have comments on them
apv.query();
while (apv.next()) { // change if to while so it will go through all approvals with comments
//gs.info(apv.comments.getJournalEntry(-1)); // add approver name here
apv = fd_data.trigger.current.comments.getJournalEntry(-1);
//sn_customerservice_technician_claims.u_approvers_comment = fd_data.trigger.current.comments.getJournalEntry(-1);
apv .update();
return apv;
}*/
 
screen shots are below:
 
Flow designer:

find_real_file.png

 

Approval :

find_real_file.png

 

 

Record producer:

find_real_file.png

9 REPLIES 9

@surajjha 

Glad to know that the line I mentioned gave you the correct sys_id i.e. fd_data.trigger.current.sys_id

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

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

@surajjha 

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

 

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

@surajjha 

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

 

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

-ooo-
Tera Contributor

@surajjha  Same Requirement for me  

I have a custom table where i am using Flow designer for approval and rejection.

In case of rejection , comment is mandatory and same has to be reflect in my custom table 

Please help me on that 

How I can access comments variable in email body?