Forums

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

Link story to Epic

Alon Erez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 26, 2018

Hi,

I want to add a link to an epic when I create a story. I'm trying to do that with groovy using script runner, but any other solution is good as well.

The Epic is known ( already exists).

The Story is newly created and I tried adding a post script function in create that will create the link to the epic.

Can someone help with this ?

I'm using Jira 7.2.8 and Script runner 5.3.7

 

Thanks,

Alon

1 answer

0 votes
Mirek
Community Champion
March 26, 2018

So you want this done dynamically? That is why trying to use Script Runner? Normally you do this from a Backlog or simply create screen... 

epics_create-issue-2.png

but when using Script Runner you should use something like this

CustomField epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link');
issue.setCustomFieldValue(epicLink,source_issue)

 

Alon Erez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2018

Thanks for your answer.

Yes I meant that the link should be added automatically, not manually, took that for granted and forgot to mention it ... 
Adding it manually works fine.

I tried your suggestion, but it doesn't work for me. Does it wok for you ?

I also tried using this:

CustomField epicLinkField = customFieldManager.getCustomFieldObjects(issue).find{it.name == 'Epic Link'}

epicLinkField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(epicLinkField), epic),new DefaultIssueChangeHolder())

 

Which I read was the right way to update the epic link field but this doesn't work.

 

Thanks,

Alon

Suggest an answer

Log in or Sign up to answer