How to add comments in approval from Workflow activity user approval

Jerin5
Giga Guru

I tried the code: current.sysapproval.comments = "Please provide Approval for "; but I get the error "illegal access to getter method getmessage in class org.mozilla.javascript.rhino exception"

Any thoughts? I don't want to do a BR .

10 REPLIES 10

sachin_namjoshi
Kilo Patron
Kilo Patron

you can configure run script activity after approval activity to update approval record comments as per your requirements.

In run script, you can query sysapproval record and update comments.

 

 

Regards,

Sachin

@sachin.namjoshi , can you clarify the approach you are providing? Are you saying add a "Run script" activity after the approval activity? 

How would the query look to make sure I get the right approval? This workflow has 3 levels of approval and so I want to make sure I put the comments specific to approval on the correct approval. 

Thanks so much for your help!

yes, you need to add run script activity after approval activity.

First you need to run script to get correct approval record after after approval activity. Also, you need to add timer after approval activity finishes 

 

you can use below

 

var arr=[];

 

var gr= new GlideRecord('sysapproval_approver');

 

gr.addQuery('sysapproval',current.sys_id);

 

gr.query();

 

while(gr.next()){

 

arr.push(gr.getValue('sys_id')); //this will contain all the sys_id

 

}

 

Regards,

Sachin

Sachin, unfortunately your suggestion won't work. Jerin wants to add a comment to the approval as that approval is created.  As you know workflows will pause on Approval activities and remain on them until the approval has been approved or rejected so your suggestion of a run script AFTER this activity will update the approval too late.