How to avoid duplicate offboarding request for same user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
Hi All,
In our ServiceNow instance, offboarding requests are getting generated based on the alert from an external application.
Also, sometimes managers are raising manual offboarding requests due to this duplicate offboarding requests are getting generated for same user.
Is there a way to avoid this duplicate tickets in both scenarios,
1) Before generating auto ticket, is there a way to check offboarding request is already available or not.
2) Before manual submission of ticket by manager, is there a way to check offboarding request is available or not.
In offboarding requests, we are using "Departing User field and Departing Date custom fields for identifying the users.
Can anyone please help me on this?
Thank in advance.
Regards
Aswathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
Hello @Aswathy3
Prevent duplicate auto-generated offboarding requests (from external alerts)
Step 1 – Look Up Existing Record
Before creating a new offboarding request, perform a lookup using:
Catalog Item = Offboarding
Departing User
Departing Date
Requested For (if applicable)
This can be done by:
Checking the Request / RITM table
Or maintaining a custom Idempotency table (preferred for integrations)
Step 2 – Decision
If record exists (Status = Success):
Do not create a new ticket
Optionally update the existing request or log the event
If no record found:
Proceed to create the offboarding request
Create an Idempotency Record so future alerts won’t create duplicates
Before Insert Business Rule (Backend enforcement)
Create a Before Insert Business Rule on:
sc_req_item (or your offboarding table)
Logic:
Query for existing active offboarding requests using:
Departing User
Departing Date
If found:
Abort insert
Add an error message
If this response proves useful, please mark it as Accept as Solution and Helpful. Doing so benefits both the community and me. 👍🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
Hi @Aswathy3 ,
Please try the solution below may be it will help you ...
- Logic: Query the offboarding table to see if an active request already exists for that user and departure date.
- Implementation:
- Flow Designer: Use the Look Up Record action before any "Create Record" action. Set conditions where Departing User is the same and State is not 'Closed' or 'Cancelled'. Use an If condition: only proceed with creation if the lookup finds no record.
- Scripted Integration: If using a script, use GlideRecord to query the table. If gr.next() returns true, skip the insert and instead log a message or update the existing ticket.
- Database Level (Optional): Create a Unique Database Index on the combination of Departing User and Departing Date to provide a hard stop against duplicates at the database level.
- Logic: Use an onSubmit Catalog Client Script that performs an asynchronous check via GlideAjax.
- Implementation Steps:
- Script Include: Create a client-callable Script Include (e.g., OffboardingCheckUtils) with a function that queries the offboarding table using the sysparm parameters for the user and date.
- Catalog Client Script (onSubmit):
- Trigger the GlideAjax call when the manager clicks submit.
- If a duplicate is found, use g_form.addErrorMessage() to inform the manager and return false to halt the submission.
- Proactive Check (onChange): For a better user experience, run a similar check when the Departing User field changes. This warns the manager immediately before they even finish the form.
If you find this useful please mark it as helpful...
Regards,
Sagnic
