How to set two fields as unique identifier for a record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2014 03:11 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2014 03:15 AM
Try setting Unique = true for both the fields in Table Dictionary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2014 03:36 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2014 03:38 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2014 05:24 AM
Rajnish,
Will this be a Unique Index or a Composite Index?
Thanks,
Subhajit