Forums

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

Script Runner - Link issue to story if in the same sprint

Yaseen July 17, 2018

 Hi,

 

I'm developing a workflow where 90% is automated.

I'm struggling to link issues back to the grand parent issue.

 

Workflow:

Create a story

Move story from Backlog to To-Do

Creates UAT ticket automatically and links it(Split from) to the story ticket

Creates Deployment ticket automatically and links it(Is Dependent on) to UAT

 

I would like to link Deployment ticket to the story ticket(Split from)

 

Would someone be able to help me achieve this via post functions?

 

Thanks 

Yas

 

1 answer

0 votes
Tarun Sapra
Community Champion
July 17, 2018

Hello @Yaseen

Since the deployment story is directly linked ot the UAT ticket, thus you would need to use "IssueLinkManager"  to get all issues linked with UAT story and then parse the links and identify the story (based on project key) and then link this story with the Deployment ticket- https://docs.atlassian.com/software/jira/docs/api/7.0.4/com/atlassian/jira/issue/link/IssueLinkManager.html 

Yaseen July 17, 2018

Thanks Sapra, points me in the right direction.

 

The documentation you linked doesnt seem to work , here is the new link:

https://docs.atlassian.com/software/jira/docs/api/7.6.1/index.html?com/atlassian/jira/issue/link/IssueLinkManager.html 

 

Ill post up the code once Im done 

Yaseen July 17, 2018

Hi Sapra,

 

I am not much of a Dev , this is what I have written so far - would you be able to guide me through the rest?

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager

def getLinkID = 0
def issueLinkManager = ComponentAccessor.getComponent(IssueLinkManager)

getLinkID = issueLinkManager.getOutwardLinks(issue.getId())

issueLinkManager.createIssueLink(Issue.getId(), getLinkID, 'Is Dependent on', null, user);

Suggest an answer

Log in or Sign up to answer