Duplicate incident creation restriction in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 02:19 AM
Hi team, how to stop duplicate incident creation using fields. if suppose, created by, opened by, few words in short description and description matches. we need to restrict the duplicate incident creation. please help me on this.
- Labels:
-
Facilities Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 02:39 AM
Hi,
Please avoid creating duplicate questions in the community.
Close this thread, and keep the discussion going in the first question you made.
https://community.servicenow.com/community?id=community_question&sys_id=a2f0b56cdb89c510a5388263059619e9

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 02:44 AM
Hi Nitin,
Create a before Business Rule in the incident table. and make it run only on insert.
then in advance tab write the below code
var incGr=new GlideRecord('incident');
incGr.addActiveQuery();
incGr.addQuery('sys_created_by',current.sys_created_by);
incGr.addQuery('opened_by',current.opened_by);
incGr.addQuery(' description', 'LIKE',current.description);
incGr.addQuery('short_description','LIKE',current.short_description);
incGr.query();
if(incGr.next()){
gs.addErrorMessage('Possible duplicate incident detected : ' +incGr.number);
current.setAbortAction(true);
}
Please mark it as helpful/correct If my answer is helpful in any way,
Best regards,
Thameem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 02:52 AM
incGr.addQuery(' description', 'LIKE',current.description);
So, under "LIKE" keyword, I need to add sentence right?
which duplicate incident also have same sentence while creation?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 02:58 AM
yes. LIKE is an operator which will check if the field contains any value the same as the one we are giving.