I use the below script to capture the dates of the Epic Due Date and display the farthest date at the Program Epic Due Date field (scripted field). If any of the Due Date in the Epic is empty, then the scripted field at the Program Epic returns empty.
The script is working fine, but considers ALL of the epics associated with the Program Epic. Can you please help me modify the script so that ONLY the child of the Program Epic is considered and no other links.
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.component.ComponentAccessor;
import java.sql.Timestamp
def allOutIssueLink = new ArrayList<IssueLink>(ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId()))
def issueLinks = allOutIssueLink?.findAll() {it.getDestinationObject().getIssueType().getName() == "Epic"}
def farthestDate
for(IssueLink issueLink : issueLinks){
def dueDate = issueLink.getDestinationObject().getDueDate()
if (dueDate == null){
return null
}
else if (farthestDate == null){
farthestDate = dueDate
}
else if (dueDate?.after(farthestDate)){
farthestDate = dueDate
}
}
def allInIssueLink = new ArrayList<IssueLink>(ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId()));
issueLinks = allInIssueLink?.findAll() {it.getSourceObject().getIssueType().getName() == "Epic"}
for(IssueLink issueLink : issueLinks){
def dueDate = issueLink.getSourceObject().getDueDate()
if (dueDate == null){
return null
}
else if (farthestDate == null){
farthestDate = dueDate
}
else if (dueDate?.after(farthestDate)){
farthestDate = dueDate
}
}
return farthestDate
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.