How do you write to the email log?

e_wilber
Tera Guru

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?

6 REPLIES 6

sachin_namjoshi
Kilo Patron
Kilo Patron

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


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.


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



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: