UCMDB and UD Practitioners Forum (Previously CMS)

ucmdb java api - set date property

Barna Kósa
Respected Contributor.

ucmdb java api - set date property



I want to update a specific CI in ucmdb (version 8.07) using the java-api provided. Everything works except for one thing. When it comes to a date/time kind of attribute the update has no result. I tried the generic way:

newCI.setPropertyValue("host_installation_date", fileContent.get(i)[8].trim());


And the specific way as well (the df.parse converts the date coming from an csv file to a date of a specific format):

newCI.setDateProperty("host_installation_date", df.parse(fileContent.get(i)[8].trim()));


None of them worked. I tried to play around a bit with the date formats but I had no luck. Do you have any idea or hint how to set a date/time attribute using the java-api?


Many thanks in advance,


New Member.

Re: ucmdb java api - set date property

Have you checked the API Reference of your installation. My version is 9.04, so may be it is a little bit different.

The url is:


or you can access the main address


and click on  "API Reference"->S


Click on Index and look for setDateProperty.


You see that the format of the Date must be a java.util.Date format, not a string format.


void setDateProperty(java.lang.String name,
                     java.util.Date value)

In order to verify existing CIs with date filled, you can use the method getDateProperty.


More generally, you can use:


void setPropertyValue(java.lang.String name,
                      java.lang.Object value)

Sets the property to the value.
The type of the property is deduced from the class of the valueparameter. The following classes are supported:

  • Boolean, Integer, Long, Float, Double and String are interpreted as their UCMDB counterparts. Using autoboxing boolean, int, long, float and doublecan also be passed.
  • byte[] is interpreted as BYTES
  • Date is interpreted as DATE
  • Iterable<String> and String[] are interpreted as STRING_LIST
  • Iterable<Integer> and int[] are interpreted as INTEGER_LIST


Parameters:name- name of the property value - value of the property  

 Please, let me know if you need further help.