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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Jira: Create a Script fragment button to create a story

I need to Create a Script fragment to create a story. This button should be on epic screen.

When the button is clicked, the create issue screen should have epic link field populated by the epic link on which the button has been clicked(i.e like when the Sub task's parent field is populated when you click create sub task button on an issue screen)

1 answer

I'm trying to do the same thing, i've linked my script fragment to a behaviour. Here's my code in the behaviour:

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
def issueManager = ComponentAccessor.getIssueManager()
def contextIssue = issueManager.getIssueObject(getContextIssueId())

if (getBehaviourContextId() == "create-story-in-epic-link") {

def epicLinkCf = customFieldManager.getCustomFieldObjectByName("Epic Name")
def linkedEpic = contextIssue.getCustomFieldValue(epicLinkCf) as Issue
getFieldByName("Epic Link").setFormValue(linkedEpic).setReadOnly(true)



The button is created properly, when i click on it, it triggers the Story popup creation screen, but it did not load the Epic key/name in the Epic Link :

any idea whats missing in my code?

thanks in advance!


Suggest an answer

Log in or Sign up to answer

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