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 06:20 AM
A composite Index, Period + CostCenter..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2014 06:29 AM
Script is better solution for this. In case you would like to avoid script, you can create a new field called Budget with default value as javascript: (current.period+ current.costcenter)
And then make this field as unique in dictionary.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2014 06:36 AM
Lorenzo,
You have a couple of options on how to do this. You could contact SN support regarding making a unique index on the two fields combined (composite index). You cannot do this be adding the unique checkbox to both fields.
Your second option is to create a 'before' business rule that checks to make sure that a record with those combined values do not already exist. If they do, setAbortAction=true and add an error message telling the user why the record would not save.
Let me know if this helps.