Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you