IBM Support

How to set a property with a choicelist to a null value

Question & Answer


Question

How to set a property with a choicelist to a null value using the P8 Content Engine Java API

Answer

Code sample using the P8 Content Engine Java API to set a property that uses a choicelist back to null.

oDoc = (Document) oStore.getObject(BaseObject.TYPE_DOCUMENT,"/myChoice");
System.out.println(oDoc.getId().toString());
String name = oDoc.getPropertyStringValue("myChoiceListProp");
String newName = null;
com.filenet.wcm.api.Properties props = ObjectFactory.getProperties();
Property nameProp = ObjectFactory.getProperty("myChoiceListProp");
nameProp.setValue(newName);
props.add(nameProp);
oDoc.setProperties(props);
System.out.println("Renamed '" + name + "' to '" + newName + "'");

[{"Product":{"code":"SSNW2F","label":"FileNet P8 Platform"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Content Engine","Platform":[{"code":"PF033","label":"Windows"}],"Version":"3.5","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
17 June 2018

UID

swg21394046