Hi,
I am using insight - Asset Management. And I wrote the insight post function.
I tried to copy data from the custom field - Date Picker and passed it into the Date attribute of insight object.
But the date in insight object always = custom field day - 1
For example: Custom field has data = 2021-05-11 00:00:00.0
→ Insight data will be: 2021-05-10
My code will :
CustomField defaultTypeCf = customFieldManager.getCustomFieldObject(customFieldId);
log.info("defaultTypeCf: [{}]", defaultTypeCf)
if (defaultTypeCf == null) {
return null
}
def newValue = issue.getCustomFieldValue(defaultTypeCf);
log.info('Text Value from Custom Field [{}]', newValue);
if (newValue == null) {
return null
}
def defaultTypeAttributeBean = objectTypeAttributeFacade.loadObjectTypeAttributeBean(attributeId);
def newAttributeBean = objectAttributeBeanFactory.createDefaultTypeValues(defaultTypeAttributeBean, newValue)
.....
objectAttributeBeans.add(newAttributeBean);
newObjectBean.setObjectAttributeBeans(objectAttributeBeans);
try {
newObjectBean = objectFacade.storeObjectBean(newObjectBean);
log.info("Create new Asset Object successfully!!!")
log.warn("newObjectBean: " + newObjectBean);
} catch (Exception e) {
log.warn("Could not create asset object due to exception:" + e.getMessage());
}
Do you have any idea?
Cheer