I have a custom field that is a type "Date". I am currently trying to update the field and its throwing me contradicting errors. It is expecting a type java.util.date in the updated field value area but then i get a series of errors with the first one saying that java.util.date is not supported. So I figured okay well then I will just create a string variable that is formatted like a 'date' variable. Then it throws me an error and says that it is expecting a java.util.date input. Does anyone have any ideas why it would be doing this? Jira version is 7.6.4. and ScriptRunner version is 5.4.28
This is the Groovy code I am testing with in Script Console:
SimpleDateFormat sf = new SimpleDateFormat("dd/MMM/yy");
Date dt = sf.parse(sf.format(new Date()));
log.warn(dt)
def myval = "13/Mar/19"
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def cf1 = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Actual Start Date'};
def changeHolder = new DefaultIssueChangeHolder();
cf1.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cf1), myval), changeHolder);
issue.store();
Current error message:
java.lang.String cannot be cast to java.util.Date