We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Create Interaction via Email

Jeroacha
Tera Contributor

I have a problem with an inbound email action "Create Interaction" that creates an interaction via email and populate the opened_for field with de userID from de user who sent the email, I have all de email properties that i need active but when i make a test sending an email to the smtp direction, in the system log of the emails it appears the log corresponding to the test but it sets as deleted and i dont know why this is happening. 
This is de code in the actions tab:

//  Note: current.opened_by is already set to the first UserID that matches the From: email address

current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;

current.category = "inquiry";
current.interaction_state = 1;
current.notify = 2;
current.contact_type = "email";
//current.opened_for = gs.getUserID();

if (email.body.assign != undefined)
   current.assigned_to = email.body.assign;

if (email.importance != undefined) {
   if (email.importance.toLowerCase() == "high") {
        current.impact = 1;
        current.urgency = 1;
   }
}

if (current.canCreate())
    current.insert();
3 REPLIES 3

GlideFather
Tera Patron

olá @Jeroacha,

is the incoming email associated with any user account in ServiceNow? 

I guess this is not a PROD if you are testing it, navigate to to the "Email diagnostic", you will see if it is not blocked.
If it is something else, please share more details - logs or something else.

_____
100 % GlideFather experience and 0 % generative AI

Yes, but if its not it shouldn't be a problem beacuse there is a proerty eneabled which creates a guest user if the incoming email is not realated to any user in the servicenow table and the interaction caller set as "Guest". I check the "Email diagnostic" and its everything okey. The log of this interaction that should be created via an incoming emal just reflects the deleted field as "true" 

Joe Walters
Tera Expert

Sorry it's so late that I saw this question. Maybe my answer will still help someone.

 

The Deleted field on an Email [sys_email] record getting set to true isn't related to Inbound Actions. It's just normal behavior with how the POP/IMAP email process works in ServiceNow. 

 

When ServiceNow retrieves an inbound email from the email server (whether it's ServiceNow's email server or one in the customer-owned email environment, either one), it deletes the emails it just imported from the email server so it doesn't re-import them the next time it connects. 

 

From Docs:

DeletedFor inbound email, indicates whether the email was deleted from the email server.

 

There is apparently some method to make it not do this, but it's highly discouraged (see KB below).

 

A couple references: