- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 11:19 AM
on the asset table, we want to prevent having duplicate entries for 'Asset tag'. How to achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 11:58 AM
In that case create a before BR on Insert Checked.
(function executeRule(current, previous /*null when async*/) {
var record = new GlideRecord('alm_asset');
record.addQuery('asset_tag', current.asset_tag);
record.query();
if (record.next()) {
gs.addErrorMessage("Asset tag already exists");
current.setAbortAction(true);
}
})(current, previous);
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 11:26 AM
Configure the dictionary entry for the 'Asset tag' field and check the 'Unique' checkbox.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 11:58 AM
it gives me error. doesn't let me as there are already duplicate records there

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 12:08 PM
You need to clean up the duplicates first and make all of the existing data unique. Once you do that you can check the 'Unique' checkbox and it will prevent future duplicates. You can use a 'before insert' business rule, but if you really need to have the data be unique you should clean it up first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 11:31 AM
open a record and right click on the asset tag and config dictionary
you should see a unique check box
if it is not there right click
add the unique and check that and save ,,
it might throw an error if there are already duplicates exist