Prevent Duplicate case creation which is created by Inbound Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2023 10:37 AM - edited ‎08-11-2023 10:51 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2023 01:37 AM
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();
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2023 08:33 AM - edited ‎08-14-2023 09:10 AM
Hi @Hemanth M1 ,
Thanks for your response, something wrong with inbound adding script using business rule.
Before Insert BR:
It is working fine, but can we do current.insert() in business rules is it good practice?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2023 11:03 AM
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.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2023 10:21 PM
Hi @Hemanth M1 ,
sample
Emp Name: ABC
Requestor Name: XYZ
Requestor E-mail: xyz@gmail.com
Date: 24/07/2023

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2023 12:14 AM
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
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025