Duplicate HR Case Getting Created

mdshahvez11
Tera Contributor

Hello Everyone,

I’m facing an issue where a duplicate HR Case is being created automatically when a case is generated via an Inbound Email Action.

Here’s the scenario:

  • A user sends an email.

  • The Inbound Action processes the email and creates the expected HR Case (with subject, description, and correct assignment group).

  • However, at the exact same timestamp, a second HR Case is created with:

    • No subject or description

    • Assignment group = some group we’re not using anywhere in our current logic

    • Created and Created by fields match exactly with the first case

I checked:

  • Email logs – only the primary case is logged

  • System logs – no useful entries for the second case

    Can Anyone suggest me on this , from where to configure this and which this is being getting triggered or created.


    mdshahvez11_0-1751874398102.png

     

7 REPLIES 7

Shraddha Kadam
Mega Sage

Hello @mdshahvez11 ,

Please check if you are using current.update method in any script. 

 

Thank you.

If my response was helpful, please mark it as correct and helpful.
Thank you.

@Shraddha Kadam 

Yes, we have two Inbound Email Actions, and both of them use current.update().

Here’s what they do:

  • When a reply is received on an existing HR case, we update the state — for example:

    • From On Hold → In Progress

    • From Resolved → In Progress

  • We also append the email body to the case’s comments field

  • Then we call **current.update()** to save these changes

However, we’ve observed that the extra HR case is being created at the very beginning, when the state of the original case is still New.
The state only transitions to In Progress after the ticket is assigned to someone.


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

// Implement email action here
gs.include('validators');

if (current.getTableName() == "sn_hr_core_case") {
var gr = current;
gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;


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

if (gr.state == 8{
gr.state = 18;
}

gr.update();
}

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




Check all these possibilities to see where the issue comes from -

  • Deactivate this Inbound Action for testing to see if it creates a duplicate case.

  • Check for any other custom business rules that might be involved.

  • Review other HR Case Inbound Actions for potential conflicts or effects.

If my response was helpful, please mark it as correct and helpful.
Thank you.

Ankur Bawiskar
Tera Patron
Tera Patron

@mdshahvez11 

is that inbound email action a custom or OOTB one?

any business rule has current.insert() on your HR case table.

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