Emails are triggering in logs subject is not showing in logs table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi
Emails are getting triggered but subject is not showing in logs table
My notification:
Logs:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @VedavalliC ,
I’ve run into this exact behaviour before, and in my experience it’s almost always the email template rather than the notification itself.
Looking at your screenshots, you’ve got a subject on the notification (test subject check ${number}), but you’ve also set the Email template to Unsubscribe and Preferences. That template isn’t meant to be the main template for a notification. It’s really a footer/helper piece, and it (or a mail script inside it) can end up overriding the subject. If any mail script involved calls email.setSubject() and that resolves to empty, it wins over whatever you’ve typed in the Subject field.
Quick way to prove it: clear the Email template field, put a simple line in Message HTML (yours looks empty, which doesn’t help either), save, and retrigger by updating an incident. If the subject shows up in the email log, you’ve found your culprit. If you still need the unsubscribe links, call the mail script inline at the bottom of the body (something like ${mail_script:unsubscribe_and_preferences}; check the exact name in your instance) instead of using it as the template.
If that doesn’t sort it, a few other things worth checking:
- Open the email record and check Email Log (sys_email_log) to confirm it was actually generated by this notification. Sometimes another notification on the same event is the one with the blank subject.
- If you have localisation enabled, look for a translated version of the notification. ServiceNow picks the version matching the recipient’s language, and a translated copy with an empty subject gives exactly this symptom.
- Look for any custom business rules on sys_email, and check whether the subject field has encryption or an ACL on it. If it does, it may just be hidden in the list view rather than actually empty.
Also, Preview Notification is handy here. If the preview has no subject either, the problem is in the template or mail script. If the preview looks fine but the log doesn’t, look downstream (translations, business rules, ACLs).
Separate note: if those emails stay in send-ready and never move to sent, check that email sending is enabled under Email Properties and that your outbound SMTP account is healthy.
Hope that helps. Let me know what the preview shows if you’re still stuck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @VedavalliC
Run below background script to find out whether subject has any value or not:
var grEmail = new GlideRecord('sys_email');
if(grEmail.get('sys_id')) {//update with your sys_email/logs record's sys_id
gs.print(grEmail.getDisplayValue('subject'));
}
If you are able to print correct value, then there may be any server side logic or most probably ACL is not able to display in sys_email list view.
If you are unable to print value, then go ahead and delete ${number} from your email notification subject and test.
If you are able to see subject as "test subject check" then it means the root cause is with ${number}
If none of the above works, then Navigate to All, type cache.do as shown below and hit enter:
Create a new notification and test it out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
ahoy @VedavalliC,
open the record to see what notification was triggered:
This is to ensure that you are reviewing the correct notification record, there can be any other that took the precedence..