Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Update FixVersion When Story Is Linked to Epic

Justin
Contributor
July 31, 2020

I have 3 scenarios that I'm working to ensure Story FixVersion fields are synced to the Epic Link they are attached to.

1. Story Created and linked to Epic - Working using PostFunction "Copy Value From Other Field (JSU)".

2. Update Existing Linked Issues when Epic FixVersion Added/Modified - Working using Scriptrunner Listener

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def epicissue = event.issue as MutableIssue
def issueManager = ComponentAccessor.getIssueManager();
def versionManager = ComponentAccessor.getVersionManager();
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

if (epicissue.getIssueType().getName() == "Epic")issueLinkManager.getOutwardLinks(epicissue.id).each {
issueLink ->if (issueLink.getDestinationObject().getIssueType().name == "Story")
{

MutableIssue issue = issueLink.getDestinationObject() as MutableIssue;

def currentValue = epicissue.getFixVersions()
issue.setFixVersions(currentValue);
issueManager.updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)
boolean wasIndexing = ImportUtils.isIndexIssues();
IssueIndexingService indexing = (IssueIndexingService) ComponentAccessor.getComponent(IssueIndexingService.class)
indexing.reIndex(issue)
ImportUtils.setIndexIssues(wasIndexing)

}
}

3. Update FixVersion on Existing Story when Linked to Epic - Not Working

In regards to #3, I'm trying to decide which approach is the best to take. Should this be a Behaviour set on the Epic Link field of the Story or Custom Listener (using IssueLinkCreatedEvent)? I am having trouble finding examples of either. Any help would be greatly appreciated!

1 answer

1 accepted

0 votes
Answer accepted
Justin
Contributor
August 5, 2020

I resolved this by using Automation for Jira plugin for now.

Suggest an answer

Log in or Sign up to answer