According to:
https://community.atlassian.com/t5/Jira-questions/Update-System-Field-Without-Updating-History/qaq-p/1745173 the thing to use is:
CustomField.updateValue
As in:
https://library.adaptavist.com/entity/update-custom-fields-without-change-history
But I cant get a date into the field:
customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), fieldValue), new DefaultIssueChangeHolder())
For fieldValue I have tried:
Code:
def fieldValue = New Date()
Error:
{"message":"Java type java.util.Date not currently supported. Sorry.","stack-trace":"java.lang.IllegalArgumentException: Java type java.util.Date not currently supported. Sorry.\n\tat org.ofbiz.core.entity.jdbc.SqlJdbcUtil.getFieldType(SqlJdbcUtil.java:907)\n\tat org.ofbiz.core.entity.jdbc.SqlJdbcUtil.setValue(SqlJdbcUtil.java:798)\n\tat org.ofbiz.core.entity.jdbc.SqlJdbcUtil.setValue(SqlJdbcUtil.java:767)\n\tat
-----
Code:
Date fieldValue1 = new Date()
fieldValue = fieldValue1.getTime()
Error:
"message":"class java.lang.Long cannot be cast to class java.util.Date (java.lang.Long and java.util.Date are in module java.base of loader 'bootstrap')","stack-trace":"java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.util.Date (java.lang.Long and java.util.Date are in module java.base of loader 'bootstrap')\n\tat com.atlassian.jira.issue.customfields.impl.DateTimeCFType.getDbValueFromObject(DateTimeCFType.java:61)\n\tat
----
Due to
https://bitbucket.org/alex1mmm/scriptrunner/src/b637e102aacd9a21ba20a7eaef2437a3e8979eb6/articles/updateissue/updateValue?at=master&fileviewer=file-view-default is seems that the getTime() - long shoudl work...