Hi,
I can use below method to set new value for an attribute (as instruction from Insight document site)
public MutableObjectAttributeBean createObjectAttributeBeanForObject(ObjectBean objectBean, ObjectTypeAttributeBean ota, String... values) throws InsightException
Now, I need to get value from a Jira Date Picker and set it to Insight attribute as Date format.
I think I need to use this method:
public MutableObjectAttributeBean createObjectAttributeBeanForObject(ObjectBean objectBean, ObjectTypeAttributeBean ota, DateFormat dateFormat, DateFormat dateTimeFormat, String... values) throws InsightException
However, I do not know how to declare DateFormat. Could you please give me any suggestion?
Best regards,
Tam
I was looking for the same information ... and after failing to find anything in the community, I figured a way to set the date value.
I could not find how to use the createObjectAttributeBeanForObject(ObjeacBean objectBean, ObjectTypeAttributeBean ota, DateFormat dateFormat, DateFormat dateFormat, String value) signature, but the following worked for me (assumed you already have facades and factories loaded)
def testObjectId = 62410
def dateAttributeId = 198
def object = objectFacade.loadObjectBean(testObjectId)
def objectTypeAttributeBean = objectTypeAttributeFacade.loadObjectTypeAttributeBean(dateAttributeId )
def objectAttributeBean = object.createObjectAttributeBean(objectTypeAttributeBean)
def objectAtrributeValueBean = objectAttributeBean.createObjectAttributeValueBean()
objectAtrributeValueBean.setDateValue(new Date())
objectAttributeBean.setObjectAttributeValueBeans([valBean])
objectFacade.storeObjectAttributeBean(objectAttributeBean)
Thanks @PD Sheehan
Maybe my direction was wrong from the beginning then I figured out the other easier way. That is converting the value to string so that it can be stored to Insight attribute.
// CF 10357 is Date Picker
CustomField toDateCustomField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10357);
def toDateValue = issue.getCustomFieldValue(toDateCustomField);
str_toDateValue = DateFormat.getDateInstance().format(toDateValue);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.