Hello Mike,
I create manually a property template with data type Object: PTO
As you suggested I create a PropertyDefinitionObject based on this PTO and I defines the RequiredClassId with an abstract dependent subclass (named MyBO).
The error message return at class defintion save is:
com.filenet.api.exception.EngineRuntimeException: FNRCE0015E: E_CONSTRAINT_VIOLATED: The operation violates a constraint of the implementation. The dependent class MyBO may not be specified as the required class for a singleton or enumeration property. failedBatchItem=0
The code is:
ClassDefinition classDef = Factory.ClassDefinition.fetchInstance(connector.getObjectStore(),
"MyFolderSubClass", null);
String rcIdString = connector.getId("
MyBO", PropertyNames.SYMBOLIC_NAME, ClassNames.CLASS_DEFINITION);
String idString = connector.getId(
"PTO", PropertyNames.SYMBOLIC_NAME, PropertyNames.PROPERTY_TEMPLATE);
PropertyTemplateObject pto = Factory.PropertyTemplateObject.fetchInstance(connector.getObjectStore(), new Id(idString), null);
PropertyDefinitionObject pd = (PropertyDefinitionObject) pto.createClassProperty();
pd.set_RequiredClassId(new Id(rcIdString));
classDef.get_PropertyDefinitions().add(pd);
classDef.save(RefreshMode.REFRESH);
Thansk for help
------------------------------
Yannick Martin
------------------------------
Original Message:
Sent: Wed April 07, 2021 05:09 AM
From: Michael Seaman
Subject: FileNet - How to set the PropertyDefinition required classid in java
If you're creating a PropertyDefinitionObject (from a PropertyTemplateObject), then prior to saving the Class Definition to which you're adding that property definition, simply set_RequiredClassId() to the id of the class of object to which the object-valued property should refer.
------------------------------
Mike
Original Message:
Sent: Tue April 06, 2021 02:32 AM
From: Yannick Martin
Subject: FileNet - How to set the PropertyDefinition required classid in java
Hello,
we want to define an object as property in a folder class (like business objects in Case Manager).
How to proceed to create such property ? The error message "FNRCE0058E: E_REQUIRED_VALUE_ABSENT" for the property "RequiredClassId" is returned at folder class save step.
Thanks for help
Yannick
------------------------------
Yannick Martin
------------------------------