- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2018 09:01 AM
This script is getting attached to a notification off of the sysapproval_approver table. I have 5 notifications that go out when the approval is rejected. I only see one gs.info line in my logs (shouldn't I see 5?) and non of the template.print is on the email except the one out of the If statement (Approver that Rejected) that's showing up fine.
Am I missing something?
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,/* Optional GlideRecord */ event) {
var gr = new GlideRecord('sysapproval_group');
gr.addQuery('parent', 'current.sysapproval');
gr.addNotNullQuery('approval_user');
gr.query();
if(gr.next()){
gs.info("lisa parent: " + gr.parent);
template.print('<p><font size="4" color="#808080" face="helvetica"><strong>');
template.print('Rejection Details</strong></font><br><font size="3">');
template.print('<b>Rejection Level:</b> ' + gr.wf_activity + '<br>');
template.print('<b>Approval Group:</b> ' + gr.assignment_group + '<br>');
}
template.print('<b>Approver that Rejected: </b> ${approver}</font></font></p>');
})(current, template, email, email_action, event);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2018 11:12 PM
Hi Lisa,
I just tested in my OOB instance, and below are my comments:
if(gr.next()){
gs.info("lisa parent: " + gr.parent); //if you can see this in logs, it means if condition is being met
template.print('<p><font size="4" color="#808080" face="helvetica"><strong>'); // This line was printed in the email
template.print('Rejection Details</strong></font><br><font size="3">'); // This line was printed in the email as well
template.print('<b>Rejection Level:</b> ' + gr.wf_activity + '<br>'); // This line was not printed in the email because I don't have gr.wf_activity field.when I removed gr.wf_activity, it got printed.
template.print('<b>Approval Group:</b> ' + gr.assignment_group + '<br>'); //same as the 4th line
}
Ensure if you are getting value of gr.wf_activity and gr.assignment_group (print their values in logs). Check logs if you get any error.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2018 11:12 PM
Hi Lisa,
I just tested in my OOB instance, and below are my comments:
if(gr.next()){
gs.info("lisa parent: " + gr.parent); //if you can see this in logs, it means if condition is being met
template.print('<p><font size="4" color="#808080" face="helvetica"><strong>'); // This line was printed in the email
template.print('Rejection Details</strong></font><br><font size="3">'); // This line was printed in the email as well
template.print('<b>Rejection Level:</b> ' + gr.wf_activity + '<br>'); // This line was not printed in the email because I don't have gr.wf_activity field.when I removed gr.wf_activity, it got printed.
template.print('<b>Approval Group:</b> ' + gr.assignment_group + '<br>'); //same as the 4th line
}
Ensure if you are getting value of gr.wf_activity and gr.assignment_group (print their values in logs). Check logs if you get any error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2018 08:09 AM
Hmmmm that's weird. I don't see this in my email at all. I do see my gs.info message in the logs (which means that the condition is met), but then in my email the only thing I see is the line AFTER the IF statement (template.print('<b>Approver that Rejected: </b> ${approver}</font></font></p>');).
I'm going to add it directly to my email and enclose it with <mail script> tags to see what happens.
Lisa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2018 08:51 AM
I see my problem now. Those pesky apostrophe's that I have surrounding my current.sysapproval what causing me problems. UGH. SO PICKY!!
Thanks so much Nitesh for your assistance!!
Lisa

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2018 10:10 PM
Thanks Lisa.. Glad you got your issue resolved.
Gud day