Defining Foreign Key Relationships
Complex validation scenarios may require you to define a foreign key relationship that correctly links values in a table to the validated Field. This ensures that values that were identified by name before you enabled foreign keys are correctly identified by ID in existing search conditions and Expressions after you enable foreign keys.
This is particularly important if duplicate values with the same name exist.
For example, the Asset Status Field is validated using the Status Field in the CI Status Lookup Table and uses CI Type as a constraint. As CIs are created, the CI Status values are assigned for each CI Type and searches are evaluated against the CI Status and CI Type values. Since the values are referenced by name, the duplicate values do not negatively impact Searches or Expressions.
Once you enable foreign keys, however, values are searched by ID rather than name, and you may have unexpected results when you use Searches and Expressions created before you enabled foreign keys.
To solve this problem, create a relationship between the CI and CI Status tables. Once the relationship is configured, Searches and Expressions evaluate against the CI Status value only, rather than the CI Status and CI Type values.
Process for Defining a Foreign Key Relationship
The general process for defining a foreign key relationship is:
- Create a Blueprint.
- Define a foreign key relationship for a Field that:
- Is validated from a Lookup Table that may contain duplicate values referenced by name.
- Has values limited by a constraint.
- Create or update validation settings for the Field where you defined the foreign key relationship.
- Publish the Blueprint.