Forums

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

How to link a jira issue to a parent user story or epic after the fact using Python jira APIs ?

Akshay Kothare
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 21, 2021

Hi !

 

I have created a few EPICS broadly based on the number of projects, I have ( say 3 ).

 

Under each EPIC, i have created individual user story ( based on engineers in my team responsible for working on the project ).

 

Then there are individual jira issues which can be filed either externally or internally. Based on which engineer is working on them and broadly which project they fall under, I'd like to link an individual jira issue or a list of jira issues to their respective parent story.

Likewise, there could be a use case, where a standalone user story, might need to be linked to a Jira Epic.

I know how to do this via the GUI.

 

Is there a way to do this through python/jira APIs ? If yes, can you pls. share some snippets of code or point me to the relevant documentation for the same ?

 

I'm trying to search online, but not really making decent progress with this.

 

Appreciate your help.

 

Thanks and regards,

Akshay

 

1 answer

0 votes
Martin Bayer _MoroSystems_ s_r_o__
Community Champion
July 21, 2021

Hi @Akshay Kothare , welcome on the community.

Epic link is custom field so you can update it on the Story with value you need. I have few lines of groovy, it might help.

def rootRequestEpic = ComponentAccessor.issueManager.getIssueByCurrentKey("key of the epic")
def story = ComponentAccessor.issueManager.getIssueByCurrentKey("key of the story")

def ID_OF_THE_EPIC_LINK_CF = XXX //you need to put ID of the Epic Link custom field here
def epicLinkCF = ComponentAccessor.customFieldManager.getCustomFieldObject(ID_OF_THE_EPIC_LINK_CF)
story.setCustomFieldValue(epicLinkCF, rootRequestEpic)

Let me know, if you need more help :) 

Suggest an answer

Log in or Sign up to answer