How to create a primary key for Combination of two fields in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2023 06:17 AM
I want to configure a composite primary key for combination of both fields in a table.
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2023 06:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2023 06:45 AM
I want only if both values entered are already in system then unique key violation error should come. Basically primary key on combination of both fields. But as per the solution provided above its not allowing even if one of the field is same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2023 06:58 AM - edited 05-10-2023 07:00 AM
You must make sure the combination has no duplicates to create a unique index. Common database requirement, not unique to Servicnow. Or do not check "Unique index". There are plenty of examples in the sys_index table.