Email with No subject

utkarshaw
Kilo Contributor

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!

0 REPLIES 0