How do you write to the email log?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 04:22 PM
I am updating a record other than current in my inbound action and because of this the Target field isn't updating.
On the logs under the email where it shows what skipped/processed/etc, how can I write to this log file so when I look at the email I know what happened? The wiki shows gs.log() should write to the email logs but that doesn't appear true.
It shows up in the system logs but not the email logs. How do I get the logs to show up on the email page?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 04:38 PM
You can use below example to create record in system logs.
var grIncident = new GlideRecord('incident');
grIncident.initialize();
grIncident.caller_id=gs.getUserID();
grIncident.comments = "received from: " + email.origemail;
grIncident.short_description = email.subject;
grIncident.insert();
//create log entry to know what created/update by this action
gs.log("<custom_action_name> Created Incident:" + grIncident.number, "EMAIL." + sys_email.sys_id);
You should then be able to view the record that was created or updated in the email logs.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 04:41 PM
gs.log() puts the text in the system logs, not the email logs. I'm trying to get it to show up in the email logs.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 05:07 PM
This is happening since OOB It's looking for the watermark to see if the mail is connected to a current record.
for your case, you can look into System Mailboxes --> Inbound --> Received to see any issues in incoming mails.
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 05:21 PM
Hi Eric,
I don't think service now allows us to capture the logs anywhere else other than system logs as long as we are dealing with records. There are some other logs like emails, events which are OOTB and captures specific logs based upon that module transaction.
See the email logs for a description of what you can see in the system log.
Starting with the Dublin release, you can use these GlideSystem error messages to display messages:
- For an information message:
- gs.log("<INSERT LOG MESSAGE HERE>", "EMAIL." + sys_email.sys_id);
- For a warning message:
- gs.logWarning("<INSERT LOG MESSAGE HERE>", "EMAIL." + sys_email.sys_id);
- For an error message:
- gs.logError("<INSERT LOG MESSAGE HERE>", "EMAIL." + sys_email.sys_id);
- References: Viewing System Logs - ServiceNow Wiki
- Inbound Email Actions - ServiceNow Wiki