How to set the date 1/1/2999 to 'Target date' custom date field in post-function. I know there is a function available but I want to write a groovy script to check summary.
If the summary = AAAA
then
set target date = 1/1/2999
else
set target date = today +7 days.
I am able to manage setting the 'ELSE' part but trying to figure out to set the static value.
Here is the sample code that I am trying
Error in my code
issue.setCustomFieldvalue(TD,input)
Can not matching method. I may have to convert string to date or missing something.
Any help much appreciated.
if(issue.summary !='AAA'){
if (TDV == "" || TDV == null) {
Calendar cal = Calendar.getInstance();
// set due date to: current date + 8 days
Timestamp DefTDD = new Timestamp(cal.getTimeInMillis()+ 14*1000*24*60*60);
//DefTDD.toString()
issue.setCustomFieldValue(TD, DefTDD)
// issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH ,false)
}
}else{
def pattern = "dd-MM-yyyy"
def input = "01/01/2999"
def date1 = Date.parse(pattern, input)
issue.setCustomFieldvalue(TD,input)
}
issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH ,false)