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

This widget could not be displayed.

You can do that using the Script Runner Plugin (https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner)

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.issue.link.IssueLinkType
import com.atlassian.jira.issue.link.IssueLinkTypeManager
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.issue.link.IssueLinkManager
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 ->
    try
    {
        normalIssue = issueFactory.getIssue()
        MutableIssue newIssue = normalIssue as MutableIssue
        newIssue.issueTypeId = IssuetypeID
        component = componentManager.getProjectComponentManager().findByComponentName(project.getId(),components[i])
        newIssue.setComponentObjects([component])
        newIssue.summary = parentissue.summary + " | " + summary
        newIssue.reporter = reporter
        newIssue.setAssignee(ComponentManager.instance.userUtil.getUserObject(component.getLead()))
        newIssue.setCustomFieldValue(cfUbi, parentissue.getCustomFieldValue(cfUbi))
        newIssue.setCustomFieldValue(cfMilestone, parentissue.getCustomFieldValue(cfMilestone))
        newIssue.setProject(parentissue.getProjectObject().genericValue)
        //Map<String, Object> newIssueParams = ["issue": newIssue] as Map<String, Object>
        Params = ["issue": newIssue]
        GenericValue newIssueDone = issueManager.createIssue(currentUser, Params)
        labelManager.addLabel(user, newIssueDone.id, 'cinema_task', false)
        //indexManager.reIndex(newIssue);
        indexManager.reIndex(newIssueDone);
        breakintoLinkType = null
        Collection cloneIssueLinkTypes = issueLinkTypeManager.getIssueLinkTypesByName("Epic-Story Link")
        for (Iterator iterator = cloneIssueLinkTypes.iterator(); iterator.hasNext();) {
            IssueLinkType issueLinkType = (IssueLinkType) iterator.next();
            if (issueLinkType.getName() == "Epic-Story Link") {
                breakintoLinkType = issueLinkType.getId();
            }
        }
        linkMgr.createIssueLink(parentissue.id, newIssue.id, breakintoLinkType, 0, currentUser)
        indexManager.reIndex(newIssue);
        indexManager.reIndex(parentissue);
    }
    catch (exception)
    {
        log.warn(exception.message)
    }
    i = i + 1
}

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Apr 22, 2018 in Jira Software

How-to setup a secured Jira Software 7.9.0 on Ubuntu 16.04.4 in less than 30 minutes

...PermissionsStartOnly=true User=www-data Group=www-data ExecStart=/opt/jira/bin/startup.sh ExecStop=/opt/jira/bin/shutdown.sh TimeoutStartSec=120 TimeoutStopSec=600 PrivateTmp=true [Install] WantedBy...

1,481 views 10 12
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