I'm getting the following error when trying to synchronize a dynamic domain retrieved from the database:
The domain on the element '[domain object]' contains an invalid entry: '[entry]'.
This only seems to happen for values that start with digits or non alpha characters. Here are my domain values:
And these are the errors:
Note that only the first two domain entries result in errors. Are there restrictions to what names can be used for dynamic domains?
Domain item names follow the same rules as for Java variable names:
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html
You can start with something like this:
public String normalize(String str) {
String result = str;
if (Pattern.matches("^\\d\\w*$", result)) {
result = "_" + result;
}
return result.replaceAll("[^A-Za-z0-9]", "_");
}
... to remove non letter/number characters from your item names, and prefix them with an underscore in the case where they start with a number, as in your example.