modify the JIRA Agile Story screen

I modified the out of the box New Feature to be part of the Agile Scrum Issue Type Scheme and it is now linked to an Epic. How do I change the Story Issue type to link to the New Feaure instead of an Epic

1 answer

You can do that using the Script Runner Plugin (

so in the post-function of the create issue, just connect your script. HerE's an exemple of a script who will create an issue of issuetype X with a Epic Link:

import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
import org.ofbiz.core.entity.GenericValue
import com.atlassian.jira.config.SubTaskManager
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.atlassian.jira.project.Project
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.config.FieldConfig
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.issue.label.LabelManager
Summary = ["Prototype - Blocking Scripted Event", "Prototype - Blocking Animation" ]
IssuetypeID = "3"
components = ["Cinema","FX"]
ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager cfManager = componentManager.getCustomFieldManager()
ProjectManager projectMgr = ComponentManager.getInstance().getProjectManager()
SubTaskManager subTaskManager = componentManager.getSubTaskManager()
IssueLinkManager linkMgr = ComponentManager.getInstance().getIssueLinkManager()
OptionsManager optionsManager = ComponentManager.getComponentInstanceOfType(OptionsManager.class)
IssueLinkTypeManager issueLinkTypeManager = ComponentManager.getComponentInstanceOfType(IssueLinkTypeManager.class)
def component
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
def issueFactory = componentManager.getIssueFactory()
def issueManager = componentManager.getIssueManager()
def indexManager = componentManager.getIndexManager()
def watcherManager = ComponentAccessor.getWatcherManager()
def userManager = ComponentAccessor.getUserManager()
CustomField cfMilestone = cfManager.getCustomFieldObjectByName("Milestone")
CustomField cfUbi = cfManager.getCustomFieldObjectByName("Ubi")
Issue parentissue = issue;
LabelManager labelManager = ComponentAccessor.getComponent(LabelManager)
Project project = parentissue.getProjectObject()
reporter = componentManager.getJiraAuthenticationContext().getUser()
currentUser = componentManager.getJiraAuthenticationContext().getUser()
i = 0
Summary.each {String summary ->
        normalIssue = issueFactory.getIssue()
        MutableIssue newIssue = normalIssue as MutableIssue
        newIssue.issueTypeId = IssuetypeID
        component = componentManager.getProjectComponentManager().findByComponentName(project.getId(),components[i])
        newIssue.summary = parentissue.summary + " | " + summary
        newIssue.reporter = reporter
        newIssue.setCustomFieldValue(cfUbi, parentissue.getCustomFieldValue(cfUbi))
        newIssue.setCustomFieldValue(cfMilestone, parentissue.getCustomFieldValue(cfMilestone))
        //Map<String, Object> newIssueParams = ["issue": newIssue] as Map<String, Object>
        Params = ["issue": newIssue]
        GenericValue newIssueDone = issueManager.createIssue(currentUser, Params)
        labelManager.addLabel(user,, 'cinema_task', false)
        breakintoLinkType = null
        Collection cloneIssueLinkTypes = issueLinkTypeManager.getIssueLinkTypesByName("Epic-Story Link")
        for (Iterator iterator = cloneIssueLinkTypes.iterator(); iterator.hasNext();) {
            IssueLinkType issueLinkType = (IssueLinkType);
            if (issueLinkType.getName() == "Epic-Story Link") {
                breakintoLinkType = issueLinkType.getId();
        linkMgr.createIssueLink(,, breakintoLinkType, 0, currentUser)
    catch (exception)
    i = i + 1

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

90 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you