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
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 }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.