Change Record creating duplicates records with same change number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 10:37 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 10:51 AM
@avinash1289 Number is not a Unique field and at times you may have some duplicate numbers in your table. Following are some of the reasons for it.
1. Change record imported from some other instance.
2. An API sync caused the duplicate number
Change request has sys_ids as a unique identifier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 11:23 AM
Hi @avinash1289 ,
Can you elaborate more on this issue. Is there any business rule triggering multiple times (or) are you creating change request from standard change the template?
You can use business rule (or) unique field option on number field.
Configure below script for validation purpose:
//For CHG Request (Before Insert BR)
var gr = new GlideRecord('change_request');
gr.addQuery('number',current.number);
gr.query();
if(gr.next()){
current.setAbortAction(true);
gs.addInfoMessage('Number is Duplicate');
}
please mark it as helpful and "accept as solution".
Thanks & regards,
Sumanth meda