Hi,
l need your help regarding groovy script statement.
l had a mistake in the following statement:
Timestamp lastClosedDate = issue.getCustomFieldValue(lastClosedDateCf)
After equals, statement gives an error.
Thanks a lot.
Hello,
Could you provide the whole script?
import com.atlassian.jira.component.ComponentAccessorimport java.sql.Timestamp
def customFieldManager = ComponentAccessor.getCustomFieldManager()def tamamlanmaTarihiCf = customFieldManager.getCustomFieldObject(111111)Timestamp tamamlanmaTarihi = issue.getCustomFieldValue(tamamlanmaTarihiCf)def lastClosedDateCf = customFieldManager.getCustomFieldObject(222222)Timestamp lastClosedDate = issue.getCustomFieldValue(lastClosedDateCf)
String statusId = issue.getStatusObject().getSimpleStatus().getId()String bulguDurumu = ''
if(issue.getProjectId().toString() == '123444' && issue.getIssueTypeId() == '1234'){
if(statusId == '10'){if(lastClosedDate.compareTo(tamamlanmaTarihi) > 0){bulguDurumu = 'xxxxx'}else{bulguDurumu = 'yyyyyy'}}else{Timestamp now = new Timestamp(Calendar.getInstance().getTimeInMillis())if(tamamlanmaTarihi){if(now.compareTo(tamamlanmaTarihi) > 0){bulguDurumu = 'aaaaaaaa'}else{bulguDurumu = 'bbbbbbbb'}}else{bulguDurumu = 'ccccccccc'}}
}
return bulguDurumu
You need to convert Object to Timestamp. And you incorrectly initialize custom fields. It should be like this
import com.atlassian.jira.component.ComponentAccessorimport java.sql.Timestampdef customFieldManager = ComponentAccessor.getCustomFieldManager()def tamamlanmaTarihiCf = customFieldManager.getCustomFieldObjectByName("fieldName")Timestamp tamamlanmaTarihi = (Timestamp) issue.getCustomFieldValue(tamamlanmaTarihiCf)def lastClosedDateCf = customFieldManager.getCustomFieldObjectByName("fieldName")Timestamp lastClosedDate = (Timestamp) issue.getCustomFieldValue(lastClosedDateCf)String statusId = issue.getStatusObject().getSimpleStatus().getId()String bulguDurumu = ''if(issue.getProjectId().toString() == '123444' && issue.getIssueTypeId() == '1234'){if(statusId == '10'){if(lastClosedDate.compareTo(tamamlanmaTarihi) > 0){bulguDurumu = 'xxxxx'}else{bulguDurumu = 'yyyyyy'}}else{Timestamp now = new Timestamp(Calendar.getInstance().getTimeInMillis())if(tamamlanmaTarihi){if(now.compareTo(tamamlanmaTarihi) > 0){bulguDurumu = 'aaaaaaaa'}else{bulguDurumu = 'bbbbbbbb'}}else{bulguDurumu = 'ccccccccc'}}}return bulguDurumu
It looks like you're new here. Sign in or register to get started.