How can we get rejected comments in notifications using mail script from Approval table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2019 11:42 PM
I wrote an email script.
Email script:- rejected_comments
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('state','rejected'); or)
gr.addQuery('document_id',current.sys_id);
gr.query();
while(gr.next()) {
gs.template(gr.comments.getJournalEntry(1));
}
I called the email script in Notifications body like in the below way
${mail_script:rejected_comments}
But in notifications, I'm not getting comments.
Thanks
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2019 12:01 AM
Change this line to below: gs.template(gr.comments.getJournalEntry(1));
template.print(gr.comments.getJournalEntry(1));
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('state','rejected');
gr.addQuery('document_id',current.sys_id);
gr.query();
while(gr.next()) {
gs.template(gr.comments.getJournalEntry(1));
}
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2019 01:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2019 12:09 AM
Hi Raj,
Why we need to glide 'sysapproval_approver' table. Just with the below code we can achieve the same.
if(current.state == 'rejected'){
template.print(current.comments.getJournalEntry(1));
}
Regards,
Kotaiah Sadari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2019 01:47 AM