How to set two fields as unique identifier for a record

loteodor
Kilo Contributor

Hi,

I want to set two fields as unique identifier for   a record of a table.

In few words, I have a table called Budget with two fields, Period (the year of the budget), and Cost Center (the cost center that is associated to the budget).

I would like to avoid the possibility to create two budget with the same Cost Center (ex. Customer Support) and Period (ex 2014).

Does it exist a way to do it without a script?

Thank you,

Lorenzo

7 REPLIES 7

RKumar3
Tera Guru

Try setting Unique = true for both the fields in Table Dictionary.


loteodor
Kilo Contributor

I tried, but now I can't create two budget of the same period, or the same Cost Center.



To be precise, I would like to allow this situation:



---> Budget_1 (2015, Customer Support) ; Budget_2(2016, Customer Support)



but not this one where both fields are equal:



--> Budget_1 (2015, Customer Support) ; Budget_1 (2015, Customer Support)



Do I have to create a custom script?


HI Lorenzo,


Above solution may not solve your issue. After digging a bit more I found below link on Unique Index. ServiceNow does not provide this functionality out of the box. However you can contact them if you need a custom unique index. Note at the end of this article says the same.



Note: Only ServiceNow can index tables in the platform. If you have performance issues with a table in your instance and think that you need the table indexed, contact Technical Support for assistance




Unique Index - ServiceNow Wiki




Rajnish


Rajnish,


Will this be a Unique Index or a Composite Index?



Thanks,


Subhajit