Facing issues with the Inbound Email Action

Shashank_Jain
Kilo Sage

Hello Community,

 

I'm facing an issue with an Inbound Email Action in ServiceNow.

I've created an Inbound Email Action with Action type set to "Record Action" and Type set to "Reply". I removed the condition from the Condition field and, in the Action Script, I'm simply trying to print a log for testing—but it’s not working.

 

Use case: When a new case is created, an email notification is sent. When we reply to that email, it should update the Additional Comments field of the corresponding case.

 

However, the script inside the Inbound Email Action doesn’t seem to execute. Even when I remove all logic and just try to log a message, it still doesn't work.

 

In the email log, I’m seeing this error: "Unable to determine origemail"

Could this be preventing the Inbound Email Action script from running?

 

Any help would be appreciated. Thanks!

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain
9 REPLIES 9

@Shashank_Jain 

there is a standard process based on which system checks which inbound action to process

Inbound email action processing 

AnkurBawiskar_0-1759303034993.png

 

If my response helped please mark it correct along with other ones from my response so that it benefits future readers.

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

Hi @Ankur Bawiskar ,

 

When I create a "receive" type email record in the sys_email table and then reprocess it, the following info message appears in the email logs:

"Skipping script ' Test- Reply', email is type 'new', which does not match Inbound Email Action's type 'reply'".

 

This message indicates that the email is being treated as type 'new', even though I’ve attached the target record while creating the email record.

 

I suspect I might be missing some kind of reference—either in the body or headers of the email record—that's required for it to be correctly recognized as a 'reply'.

 

Also, I wanted your suggestion:
Would it be a good idea to enable outbound email temporarily and use a real reply to get the correct headers and body structure for reference?

Thanks.

 

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

@Shashank_Jain 

yes somewhere something is missed as config and hence it's not working.

You can enable outbound email but ensure it goes only to 1 email address so that users are not bombarded with the emails in their inbox and then test by actually replying.

AnkurBawiskar_0-1759309852481.png

 

If my response helped please mark it correct along with other ones from my response so that it benefits future readers.

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

@Ankur Bawiskar ,

 

Its giving this info message now : Test Basic Case - Reply : did not create or update table_name using current

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

@Ankur Bawiskar ,

 

We used this particular script in the inbound action script -

(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
    //add CC to watchlist array
	
    var userArray = [];
    var copied = email.copied.toString().split(',');
    for (var i = 0; i < copied.length; i++) {
        var contact = new GlideRecord("sys_user");
        contact.addQuery('email', copied[i]); //changed here
        contact.query();
        if (contact.next()) {
            userArray.push(contact.getUniqueValue().toString());
        }
    }
    
    if (current.state == 3 || current.state == 7) {
        var gr = new GlideRecord('table_name');
        gr.initialize();
        gr.account = current.account;
        gr.short_description = email.subject;
        gr.description = email.body_text;
        gr.contact_type = current.contact_type;
        gr.u_contact_method = current.u_contact_method;
        gr.impact = current.impact;
        gr.state = 1;
        gr.contact = current.contact;
        gr.assignment_group = current.assignment_group;
        gr.priority = current.priority;
        gr.channel = current.channel;
        gr.product = current.product;
        gr.comments = "Case created from reply email to case " + current.number + " which was already closed.";
		gr.watch_list = userArray.toString();
        gr.insert();
    } else {
        current.comments =  global.ReplyExtractor(email).getReply();
		current.watch_list = userArray.toString();
        current.update();
    }

})(current, event, email, logger, classifier);
If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain