Unique not working in service-now

soundarSN
Kilo Explorer

Hi all,

I have created a new string field with unique.
But its not Enforces uniqueness on the field. Its a bug in service-now?
Please any guide us, how we will achieve unique string field in service-now.

8 REPLIES 8

Uparerik
Giga Contributor

For some reason, if you enable the Unique check box via dictionary option, it doesn't seem to work. Enable the same by Personalize Form layout at the required field and that should work
- Udhay


merbs
Mega Contributor

I realize this is a really old thread, but after upgrading we experienced a field where unique was set to true, but not enforced. At the database level, the field was not unique.



To resolve, we turned if off and on.


Thank you for your Information, this solved my problem.

CapaJC
ServiceNow Employee
ServiceNow Employee

I just tested with the following, which worked as expected:
1) created a new 40-character String when personalizing a form
2) Personalize Dictionary on that new field, add the Unique field to the Dictionary form, set it to true, and Update
3) Enter a value for that field in one record in my table, and Update
4) Enter the same value for that field in another record in my table, and attempt to Update

After clicking Update on the second record, I got the expected error: "Unique Key violation detected by database" and the form submission was cancelled.