How to add only unique value in a field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 11:14 PM
Hi Team,
How to add only unique value in a field.
In cmdb_hardware_product_model table I have a field called Barcode, In this field I want add a value, same value If I am trying to enter in any another record in model table, it needs to through an error.
EX: I am having 10 records in model table, In one record I have entered Hopeforthebest in Barcode field. If I enter same value in remaining 9 records, then It should show an error message.
How can we achieve this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 11:21 PM
Hello @Gopal14
You can make utilize the UNIQUE featue for that particular field and change the value to "true"
Before doing that you need to remove duplicate information if exists.
Hope it helps:)
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 11:30 PM
Hi @Gopal14
You can achieve this by two ways-
on dictionary you can set it as unique true.
or another way is writing a BR before insert/update - check barcode value is existing in any record if yes then abort the action and show error message.
Thank you!!!
Vishakha Yadav