Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Auto fill in Epic based issue type in a Jira Software project

Crystal Gummo April 19, 2018

I have a Jira Software project where the team has asked for a very specific change to the workflow: 

When a new issue is created and the issue type is ABC, update the Epic field for that issue to be in the XYZ epic.

Once caveat:  Any changes I make can't break jira's automatically created workflow.   This means what when the team adds new status' or scrum board columns later, my change should still be in place.   I'm hoping, because the change will be on create, that's not likely to be a problem

2 answers

1 accepted

1 vote
Answer accepted
David Fischer
Community Champion
April 20, 2018

Hi Crystal,

I can't really help with ScriptRunner, but if you don't find a solution, you can certainly do it easily with JMWE's Set Field Value post-function. Let me know if you decide to go that way and need help.

Crystal Gummo May 3, 2018

This is exactly what I ended up doing.  Worked like a charm!

Like EDV CIM likes this
0 votes
Jenna Davis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 20, 2018

Hello, 

Something close to this should work for you as a post function on the create transition:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue

def issueType = "Your issue type" // the issue type you want use this with
def epic = "Your epic key" // the key of the epic you want to link to

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
def epicLink = customFieldManager.getCustomFieldObjects(issue).find{it.name == "Epic Link"}
def newEpic = issueManager.getIssueObject(epic)
MutableIssue issue = issue as MutableIssue

if(issue.issueType.name == issueType){
issue.setCustomFieldValue(epicLink, newEpic)
}

Let me know if you have any further questions, or had something else in mind. :)

Jenna

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events