What is the best approach to enforce unique values in a Module? For example, consider a list of shops with a field named 'ShopCode'. We want to make sure that the content editor can only enter unique ShopCodes.
One solution is to create a validation rule, such as 'UniqueShopCodeValidationRule', which checks if an item with the entered ShopCode already exists and apply this rule to the 'ShopCode' field using the field editor. A drawback is that the 'UniqueShopCodeValidationRule' could also be applied to other fields, although the advantage is that we can provide the content editor with a message if the shop code already exists.
With the IInfoObjectEventHandler we could also perform this check, but I don't see how we could display a message to the content editor indicating that the shop code already exists. Am I overlooking another possible approach?Describe your question...
Environment
Xperience by Kentico version: [30.6.0]
.NET version: [8|9]
Execution environment: [Azure]