Issue
When passing an optional custom field that has a unique value constraint as application metadata:
You see a "Missing field" error in TeamServer when viewing the application:
The optional field [fieldname] failed validation. Check your agent configuration and ensure valid value to avoid error.
Resolution
Double check that the field is being passed correctly in agent configuration, for example via a JVM property:
-Dcontrast.application.metadata
or YAML:
application:
metadata:
If all looks fine, check the Contrast agent logs for the following:
2020-02-27 09:52:37,603 [Contrast Application Updater a] ERROR - Field '[fieldname]': Value already used
This error indicates that the value supplied in the agent configuration has been picked up, but the value specified for the field is already in use by another application. This breaks the unique value constraint for the the field and is therefore not allowed for the new application.
If you are a Server Admin in TeamServer - Under the Applications screen, you can search using the custom fields. Applications with a matching metadata field will be returned. Make sure to also check archived applications as the error will be reported even if the application with the matching value has been archived. The application needs to be deleted for the value to be accepted for a different application.
See also:
Organization Settings >> Application Defaults