- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Team,
ServiceNow OOB allows duplicate record while manual entry [by selecting Insert and stay] on Windows Server.
The IRE works only during importing data.
How do I avoid that? I think I need to write Business Rule on Before Insert but not sure how do I go about it.
Maybe I need to verify Name, Serial number etc.
Can anyone please help?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Sunny14,
Please refer to the link below:
Solved: How to restrict duplicate records entry in a table... - ServiceNow Community
If it is helpful, please mark it as helpful and accept the correct solution by referring to this solution in the future it will be helpful to them.
Thanks & Regards,
Abbas Shaik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Sunny14,
Please refer to the link below:
Solved: How to restrict duplicate records entry in a table... - ServiceNow Community
If it is helpful, please mark it as helpful and accept the correct solution by referring to this solution in the future it will be helpful to them.
Thanks & Regards,
Abbas Shaik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Sunny14 ,
Examine which fields are unique in your case, do a GlideRecord check to see if atleast one record is there and invalidate insert.
Sharing a template:
(function executeRule(current, previous /*null when async*/) {
if (gs.nil(current.name))
return;
var gr = new GlideRecord('cmdb_ci_win_server');
gr.addQuery('name', current.name); // I have used name as unique identifier, if you have serial_number as unique identifier, you can replace name with it in query
gr.setLimit(1);
gr.query();
if (gr.next()) {
gs.addErrorMessage('A Windows Server CI with the same Name already exists: ' + current.name);
current.setAbortAction(true);
}
})(current, previous);
Note that BR will run on import as well.
Regards,
Ehab Pilloor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you @Ehab Pilloor for your response. It was very helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Sunny14,
Thanks for marking it as Helpful. Please mark above answer as solution too so that it helps anyone with similar query.
Regards,
Ehab Pilloor