I would like to automatically create an Epic, when it's parent is transitioned to In-Progress.
Some background: I've configured portfolio for jira to have an initiative issuetype as the parent to the epic. The goal is that when we transition the Initiative to In progress, an epic will be automatically created and linked to the Initiative.
What I've done:
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
UserMessageUtil.success('Reporting Epic, created successfully.')
issue.summary = 'Reporting: ' + sourceIssue.summary
def cf = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == 'Issue Key'}
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
def parentIssue = issueManager.getIssueObject(cf as String) // Parent issue key here
def parentLink = customFieldManager.getCustomFieldObjectByName("Parent Link")
parentLink.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(parentLink), parentIssue),new DefaultIssueChangeHolder())
The Epics are created in the correct project, however, the linking to the intiative is not working. Please advise
last line parentIssue shouldn't be sourceIssue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.