How to add only unique value in a field

Gopal14
Tera Contributor

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

2 REPLIES 2

Murthy Ch
Giga Sage

Hello @Gopal14 

You can make utilize the UNIQUE featue for that particular field and change the value to "true"

MurthyCh_0-1724307617103.png

Before doing that you need to remove duplicate information if exists.

Hope it helps:)

 

Thanks,
Murthy

vishakhayadav24
Tera Guru

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