I have a custom field which allows selecting versions. From the selected version in the field, the release date should be extracted and that should be set as the due date for an issue created . (say newSubTask ). How to do that?
What I did was:
def versionCF = customFieldManager.getCustomFieldObjectByName("Fix Version(s)")
String valueOfversionType = parentIssue.getCustomFieldValue(versionCF)
Project project = parentIssue.getProjectObject()
Version versionn = versionManager.getVersion(project.getId(), valueOfversionType)
newSubTask.setDueDate(new Timestamp(versionn.releaseDate.time))
But I get the following error:
2016-11-23 10:18:10,909 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2016-11-23 10:18:10,911 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: TPK-129, actionId: 1, file: <inline script>
java.lang.NullPointerException: Cannot invoke method getReleaseDate() on null object
at Script1007.run(Script1007.groovy:61)