Inbound email action not writing email body to comment field

David Lundy
Tera Contributor

Hi all,

 

I want to allow a user to reply to an email notification and write the reply back to the Comments field on my custom application table; just like Incidents does.  I've got the inbound email action written and it is being processed.  However, the reply contents are not being saved to the Comments field like they do with Incidents.

 

If I expose the "Emails - autogenerated" or "Emails - correspondence" options on the activity feed, I can see the reply that was sent...along with the entirety of the email.  Not what I want.

 

The code of my email action is about as simple as it can be:

(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

    current.comments = "Reply from: " + email.origemail + "\n\n" + email.body_text;
    current.update();

})(current, event, email, logger, classifier);

 

I've checked the logs for the email and I get the ubiquitous: "User email comments on Library Info : did not create or update x_shce_library_inf_requests using current" information log entry.  

 

So, I guess my question is, what is preventing SN from using the 'current' object to add just the reply text like Incidents?

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@David Lundy 

is the same person replying to ServiceNow to whom the email was sent?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@David Lundy 

seems access issue. the user who is replying might not have write access to that record

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

This is in our company's development instance (not my PDI), so the email is being sent to a user's "email" address, but the server is routing to a dummy "system" email account used for just this purpose.  That is, the test email is going to "bob@domain.com" but is delivered to "system@domain.com".  The reply is thus coming from "system@domain.com" and not "bob".  I'm not entirely sure whether the "system" account has the correct permissions to the table/field though.

 

After some testing, the email is being received and processed by the system, but I have to enable "Emails - Correspondence" on the activity filter on the Journal field in order to see the responses.  I'm not sure if this is the same problem or a different one now.