Skip to end of metadata
Go to start of metadata

Imagine you want to ensure that a given property value is unique within the scope of all objects in the repository. For example, let the user object have the multivalued emailAddresses extension property, and we want to ensure uniqueness of values of this property.

The schema extension should contain something like this:

How to ensure value uniqueness? We will employ two midPoint features:

  1. target-less mappings in object template,
  2. isUniquePropertyValue function.

We will construct the following mapping in the default user template:

Note that there is no target for this mapping. Its sole responsibility is to check if the new email address(es) supplied are unique or not. If they are, nothing is changed. However, if they are not, an exception is thrown and the current operation (e.g. saving a user) is aborted.

If you want to see which object(s) cause the uniqueness to be lost, you can use getObjectsInConflictOnPropertyValue method:



  • No labels