The CreatorCon Call for Content is officially open! Get started here.

Request rejected comments into a notification

jrhoads
Giga Contributor

Hello All,

I could use some help. I have been trying to get a rejected notification email to include the approver's rejection comments.   I have tried several scripts to get his to work without fruitful results. The notification is targeting the sysapproval_approver table.

I tried the tree picker and then previous articles on the community to find an answer that works.

var gr = new GlideRecord('sysapproval_approver');

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

gr.addQuery('comments', current.comments);

gr.query();

if(gr.next()){

  template.print("Rejected comments: " + gr.comments.getJournalEntry(1);

}

Thanks for any help.

1 ACCEPTED SOLUTION

twright5
Kilo Expert

Try removing the gr.addQuery('comments;, current.comments);


once you return from the query(), then just get the comments.



var gr = new GlideRecord('sysapproval_approver');


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


gr.addQuery('comments', current.comments); Remove this line


gr.query();


if(gr.next()){


  template.print("Rejected comments: " + gr.comments.getJournalEntry(1);


}



If you still have trouble getting the comments, try setting getJournalEntry to -1;



Tom


View solution in original post

6 REPLIES 6

sarthak92
Giga Expert

Hi,

 

This did not work for me. I have the same requirement and i am useing the same email script mentioned above and pulled out on the body of the notification made on the kb_knowledge table. No Luck for me. It is generating the notification but not pulling the comments.

TiffanyL
Tera Contributor

I had the same results after creating the script. Unfortunately, the notification fired but the comments appear null.