Email with No subject
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi everyone,
We’re facing an issue in our production instance where system-triggered emails are being sent without a subject line. let me give you'all some context,
We have a UI Action on the Approval table that triggers an event for sending a reminder notification.
The corresponding notification is configured on the Policy table.
The email subject is being set dynamically using an Email Script with email.setSubject().
This setup works perfectly in Dev, the subject starts with “Reminder:” followed by the policy name.
However, in Production, for one particular record, the system triggered seven reminder emails (one per approver), and all were sent without any subject line.
When I reproduced the same scenario in Dev, everything worked fine — the subject and policy name appeared correctly.
It seems that in Production, the subject and policy name are both coming up empty, even though the email script should be setting them. I have added the Email Script and Script Action code that are responsible for setting and triggering the notification. Has anyone encountered a similar issue before?
Any insights on what might cause the subject line to appear blank even when it’s being set dynamically in the email script would be greatly
Email Script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var duedat = '';
var app = new GlideRecord("sysapproval_approver");
app.get(event.parm2);
duedat = app.due_date;
var actnDueDate;
var gdt = new GlideDateTime(duedat);
actnDueDate = gdt.getDate();
email.setSubject("Reminder: Approval Reminder for " + app.document_id.name);
template.print(actnDueDate);
})(current, template, email, email_action, event);
Script Action:
var getApprovers = new GlideRecord('sysapproval_approver');
getApprovers.addEncodedQuery('document_id='+current_sys_id+'^state=requested');
getApprovers.query();
while(getApprovers.next()){ gs.eventQueue('sn_compliance.policy_reminder_notify',getApprovers,getApprovers.approver.toString(),getApprovers.sys_id);
}
response.sendRedirect("sn_compliance_policy.do?sys_id="+current_sys_id);
gs.addInfoMessage(gs.getMessage("Reminder notification has been initiated successfully"));appreciated.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Greetings @utkarshaw ,
I see the .eventQueue method is being used to fire an event and trigger the Notification but I don't see any information about the contents of the Notification record itself. Can you share any information from either the Notification record (which might contain Subject line information) or the E-mail script that you are calling from within the Notification that is using the email.setSubject method? Any information you can provide would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @lpruit2 ,
Thank you for responding on this. We are using an email script for setting email subject dynamically and calling that script in notification body ${mail_script:due_date_for
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var duedat = '';
var app = new GlideRecord("sysapproval_approver");
app.get(event.parm2);
duedat = app.due_date;
var actnDueDate;
var gdt = new GlideDateTime(duedat);
actnDueDate = gdt.getDate();
email.setSubject("Reminder: Approval Reminder for " + app.document_id.name);
template.print(actnDueDate);
})(current, template, email, email_action, event);_approval}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @lpruit2
Thank you for responding on this. We are using calling an email script in notification body
to set subject dynamically
${mail_script:due_date_for_approval}
Email Script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var duedat = '';
var app = new GlideRecord("sysapproval_approver");
app.get(event.parm2);
duedat = app.due_date;
var actnDueDate;
var gdt = new GlideDateTime(duedat);
actnDueDate = gdt.getDate();
email.setSubject("Reminder: Approval Reminder for " + app.document_id.name);
template.print(actnDueDate);
})(current, template, email, email_action, event);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @lpruit2
Thank you for your response on this. We are using an email script to set subject dynamically using email.setsubject . And we are calling it in the notification body as ${mail_script: due_date_approval}
, thank you,
