diff --git a/experiment/src/org/labkey/experiment/controllers/property/PropertyController.java b/experiment/src/org/labkey/experiment/controllers/property/PropertyController.java index 1b0324ecbbd..d318dd83d83 100644 --- a/experiment/src/org/labkey/experiment/controllers/property/PropertyController.java +++ b/experiment/src/org/labkey/experiment/controllers/property/PropertyController.java @@ -521,8 +521,18 @@ public Object execute(DomainApiForm form, BindException errors) DomainKind kind = PropertyService.get().getDomainKindByName(kindName); if (kind == null) throw new IllegalArgumentException("No domain kind matches name '" + kindName + "'"); - String typeURI = "urn:lsid:labkey.com:" + kindName + ".Folder-1000.1001:1002"; // note using a fake lsid here, since not all domain kinds override generateDomainURI - Domain domain = PropertyService.get().createDomain(getContainer(), typeURI, "test"); + + // try using the DomainKind to generate a domain URI, if it supports it. default to using a fake / representative URI + String typeURI = null; + try + { + typeURI = kind.generateDomainURI("schemaName", "queryName", getContainer(), getUser()); + } + catch (AssertionError ignored) {} // no-op if the DomainKind does not support generateDomainURI() + if (typeURI == null) + typeURI = "urn:lsid:labkey.com:" + kindName + ".Folder-21085:Test+Domain+Name-115c61b7-4faa-103e-8e7f-a47ad552213c"; + + Domain domain = PropertyService.get().createDomain(getContainer(), typeURI, "queryName"); boolean checkFieldNames = !domainDesign.getFields().isEmpty(); boolean checkDomainName = domainDesign.getName() != null;