I have two custom date field:
Incident Reported Date and Target REQ Completion Date.
I have to update Target REQ Completion Date 3 weeks ahead based on the date selected in Incident Reported Date.
Script:
import com.atlassian.jira.component.ComponentAccessor
import java.sql.Date
import java.sql.Timestamp
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("issuekey")
def IncidentReportDate = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Incident Reported Date")
def REQCompletionDate = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Target REQ Completion Date")
Timestamp csDate1Value = (Timestamp) issue.getCustomFieldValue(IncidentReportDate)
Date csNewDateValue = new Date(csDate1Value.getTime() + 21*24*60*60*1000);
REQCompletionDate.updateValue(null, issue, new ModifiedValue("", (Object) csNewDateValue), new DefaultIssueChangeHolder())
But this script not working.
Can anyone help with this.
Thanks in advance,
Swapna