I have a request to update EPIC (End date) , Depending on the completion date of the last story in the Epic.
Any post functions that could achieve this (or ) any script functions available.
Tried few postfunctions , but the requirements missing some criteria.
REF : ( Tried the below scrips but have some issues , my backgroud is not in to programming so any suggestions ??)
https://library.adaptavist.com/entity/close-an-epic-when-all-the-issues-under-that-epic-are-closd
+
https://library.adaptavist.com/entity/update-the-epic-link-for-an-issue-in-jira
(Note) :just need to merge both the scripts and the last story should be considered.
Thank you
Hi @siva ,
I have tweaked a bit the adaptavist script, see below :
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.status.category.StatusCategoryimport java.sql.Timestamp;import com.atlassian.jira.issue.util.DefaultIssueChangeHolderimport com.atlassian.jira.issue.ModifiedValue// the name of the issue linkfinal String issueLinkName = "Epic-Story Link"def issueLinkManager = ComponentAccessor.issueLinkManagerdef epicIssue = issueLinkManager.getInwardLinks(issue.id).find { it.issueLinkType.name == issueLinkName }?.sourceObject//If the story is not attached to an Epic, do nothingif (!epicIssue) {return}// Find all the linked - with the "Epic-Story Link" link - issues that their status is not completeddef linkedIssues = issueLinkManager.getOutwardLinks(epicIssue.id).findAll { it.issueLinkType.name == issueLinkName }*.destinationObject?.findAll { StatusCategory.COMPLETE != it.status.statusCategory.key}// If there are still open linked issues (except the one in transition) - then do nothingif (linkedIssues.size > 0){return}int dateFieldId = 11200def dateField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(dateFieldId)def dateFieldValue = epicIssue.getCustomFieldValue(dateField)def currentDate = new Timestamp(new Date().getTime());dateField.updateValue(null, epicIssue, new ModifiedValue(dateFieldValue, currentDate), new DefaultIssueChangeHolder())
Update the custom field id. Add this script in the story workflow, in the transition to the last status.
This is based on the status category, if all the child stories are in a green status, then the date field will update on the epic.
Antoine
@Antoine Berry
Thanks a lot Antoine ,
Checked the script , seems to do the job.
Need a little more R&D in Cloud instance will reach out for you in case i find any road blocks.Cheers....!!
We have another child request.
IT is to update the Sprint End date ( in which the story belongs)to EPIC (( not just the story end date))
any extension of the code ??
I am not sure to understand, could you please specify the exact behaviour ?
It looks like you're new here. Sign in or register to get started.