Hi
I'm struggling to find a syntax that will update a custom date field using scriptrunner escalation service
my code is
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.id == 'customfield_13202'}
Date curr = new Date()
Calendar cal = Calendar.getInstance()
cal.setTime(curr)
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY)
String dateFormat = "d/MMM/yy"
try {
issueInputParameters.addCustomFieldValue(cf.id, new java.text.SimpleDateFormat(dateFormat).format(cal.getTime()))
} catch (Exception e) {
log.debug(e.getMessage())
}The date format is accepted by date field in edit. I can set fields like description, Field id is correct
debugging doesn't highlight an issue
log.debug("cal 1 " + cal.getTime())
log.debug("cal 2 " + new java.text.SimpleDateFormat(dateFormat).format(cal.getTime()))
log.debug("field " + cf.id +"/"+ cf.getIdAsLong())
->
[c.onresolve.jira.groovy]
[c.onresolve.jira.groovy] cal 1 Mon Feb 20 11:47:36 GMT 2017
[c.onresolve.jira.groovy] cal 2 20/Feb/17
[c.onresolve.jira.groovy] field customfield_13202/13202
[c.onresolve.jira.groovy] [20/Feb/17]
has anyone got this to work. I've seen some similar posts but no conclusive approach
Tom