Set Issue Assignee Based on Epic Assignee

Haddon Fisher April 24, 2013

Is there a way using either stock JIRA\Greenhopper or an add-on which will allow me to set an issue's assignee to match the assignee of either a linked issue or an epic?

My team works on a variety of products and we use epics as a way to roll up all of the stories associated with a particular product. Each product (and therefore epic) has a technical lead (who I store in the epic's 'assignee' field) and I'd like any stories linked to that epic to inherit that assignee by default.

We also use linked issues to track bugs associated with particular stories, and it would be awesome if I could auto-assign those bugs to the owner of the originating story as well.

2 answers

0 votes
Deleted user July 2, 2014

I'm probably a bit late to help you, but Jira Misc Workflow extensions add-ons provides lots of additional post-functions that can enable you to inherit from parents or linked items (or to set parents or linked items). See attached screenshots for examples.

If you want the user to see the field values in the create form (rather than for them to be added in a post-function) you would need to write a jira Behaviours script.

Haddon Fisher July 6, 2014

Thanks Mark! We actually ended up transitioning to a different epic\story architecture that negates this use-case, but I will give this a crack when I get a minute and see if it works. My only concern is that it doesn't look like adding a story to an epic uses the same "linked issues" logic, so it might not be able to take advantage of these post-functions.

Deleted user July 6, 2014

Yes, putting this in a post function is quite limiting. We've also written Jira Behaviours scripts to inherit story attributes from their parent.

The script below takes a custom field from the epic and puts in on the child. You could adapt this for other fields (e.g. assignee)

// Set SVR Number based on the SVR Number of the parent epic (if one exists)
//
// Script by Mark Love, 4th July 2014

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager 
import com.atlassian.jira.issue.fields.CustomField

// Set up variables to link to the two form fields we're interested in
FormField SVR = getFieldByName("SVR Number")
FormField epicLink = getFieldByName("Epic Link")

// The value of the Epic Link field includes the prefix "key:" so we need to get rid of this
def epicLinkKey = epicLink.value.replaceAll("key:", "")

// Set up objects to enable us to access the parent issues and custom field
ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()

// get an issue object for the parent
def epic = componentManager.getIssueManager().getIssueObject(epicLinkKey)

// create a custom field object for SVR Number
cfSVR = customFieldManager.getCustomFieldObjectByName("SVR Number")
// get the value of SVR for the epic
def epicSVR = epic.getCustomFieldValue(cfSVR) 

// update the value on the form with the value from the parent.
SVR.setFormValue(epicSVR)

Haddon Fisher July 20, 2014

I think this would probably do the trick, but as OnDemand users we can't use them. Wa waaaaa.

0 votes
Haddon Fisher April 24, 2013

I've been doing some research on some other issues and came across the 'Behaviors' and 'Script Runner' add-ons, both of which might be able to handle this. Can anyone confirm? We're running onDemand right now so I can't really test either one yet.

Suggest an answer

Log in or Sign up to answer