Prevent Duplicate case creation which is created by Inbound Action

Gayatrin
Tera Contributor

Hi,
I have an Inbound action created, through which an offboarding Lifecycle case is being created. I want to prevent duplicate case creation if a case already exists for that leaver(subject_person). Any suggestions on how we can do this?
Thanks in advance.

9 REPLIES 9

Hi @Gayatrin ,

 

You got to adjust your script 

1)don't see eventreason variable deaclared , i assume your trying parse from the email body

is it coming as value pair i.e eventreason:xyz ?? , if so then you should use like email.body.eventreason to retrive 

2)current.subject_person will not give expected value since its a new emil coming in , you should retieve from the incoming email  and search with the name like > gr.addQuery("subject_person.name", email.body.eventreason);

3)to create case , remove set fields (since your aborting action in the script), include the same logic in the else part and do current.insert();

 

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi @Hemanth M1 ,

Thanks for your response, something wrong with inbound adding script using business rule.

Before Insert BR:

RithikaN_0-1692027073297.png

It is working fine, but can we do current.insert() in business rules is it good practice?

Hi @Gayatrin ,

 

Don't use if its before insert/update , you can use if its after insert/update

 

I would still suggest inbound action script over business rule since you know the trigger.

you need to verify

how to retrive subject person from the incoming email.

 

if you have the sample email(if its not confidential to share the screenshot), i can help you out parse the email.

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi @Hemanth M1 ,

sample

Emp Name: ABC

Requestor Name: XYZ

Requestor E-mail: xyz@gmail.com

Date: 24/07/2023

As per sample email, you can trieve emp name , requestor name , requestor email and date as follows 

 

var empName = email.body.emp_name;

var requesorName =email.body.requestor_name;

var requestorEmail =email.body.requestor_e-mail;

var date = email.body.date;

 

the logic here is inbound actions converts value pair to lower case and add underscore if any spaves more info: https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/administer/notification/reference/... 

 

use these values in your scirpt

for example to check subject person 

//gr.addQuery("subject_person.name", requesorName ); //this check subject person name same as reuestor name in the email body

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025