- 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:52 AM
Yeah it gave me error ! and i still can save duplicates!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 11:54 AM
Actually it doesn't let me make it unique
- 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 01:52 PM
Please mark my response as correct and close this thread if it answers your question. This helps in removing this thread from unanswered list and helps community.
-Thanks
Prateek kumar
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 12:03 PM
you need to delete the existing duplicates and then check unique ,, then you wont have issues ,,, on the asset tag right click and group by asset tag ,, and delete the duplicates , this will fix the issue