Forums

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

Set Epic Link field with Script Runner behaviors

Michael Shechter July 19, 2018

Hi,

I have a custom field that contains issue key, I'm trying set "Epic Link" field with this issue key with the following script with no success :

 

import com.atlassian.jira.component.ComponentAccessor
// Get issue key from custim field
def sourcefield = getFieldById(getFieldChanged())
def sourcefieldVal = getFieldById(getFieldChanged()).getValue()
//Get Epic link Field
def epicLink = getFieldByName("Epic Link")
//check Action in Create and
if(actionName == "Create" && epicLink != null ){
//Set epic link
epicLink.setFormValue(sourcefieldVal)

Can anyone help me with this? 

 

 

Thanks.

 

 

1 answer

0 votes
Mark Markov
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.
July 19, 2018

Hello @Michael Shechter

Setting issue key in epic link name is enough. It should work.

But i have some questions about your code.

You have some custom field(sourceField) that contains issuekeys of epics? Am i right? And are they all have epic issue type?

And condition is: If (create screen and epic link already setted) then set link to epic from custom field. Right?

Michael Shechter July 21, 2018

Hi @Mark Markov,

Yes, the "source field" is single Text line and contain one issue Key of epic.

I wrote the wrong condition the condition should be:

if(actionName == "Create" && sourcefield != null ){
//Set epic link
epicLink.setFormValue(sourcefieldVal)

Suggest an answer

Log in or Sign up to answer