Hi All,
Please can you advise:
I'm trying to create a script runner post-function to add one year to a field.
Have the below,
------------------------------------------------------------
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.CustomFieldManager
Issue issue = issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
// the dependent custom field
def dateACF = customFieldManager.getCustomFieldObjectByName("Forecast Date")
// get the value of the date A custom field
def dateAValue = issue.getCustomFieldValue(dateACF) as Date
// build the new date
def dateB = Calendar.getInstance()
// copy to the new date the value of the Date A custom field
dateB.setTime(dateAValue)
// add one year
dateB.add(Calendar.YEAR, 1)
//write back to custom field
issue.setCustomFieldValue(dateACF,dateB)
------------------------------------------------------------
This appears to validate OK in the Scriptrunner add on but when i try to execute the workflow transition i get the below error:
"Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: http://confluence.atlassian.com/x/3McB java.util.GregorianCalendar cannot be cast to java.util.Date"
Any advice would be appreciated.
Tom