Hi,
is it possible to inherit fields from Epic Story to all epic-linked issues.
For example I want to inherit the field "Affects Version/s" which is a standard jira field from an epic to all it's epic-linked user storys.
I also want to inherit custom field values.
Does anybody offer a solution about this?
Is it possible to cover this with Script Runner?
Thanks,
Michael
Allright, I got it. Here is my solution:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.CustomFieldType
import com.atlassian.jira.issue.fields.CustomField
import org.apache.log4j.Category
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItemImpl
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.util.ImportUtils
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
def issueManager = ComponentAccessor.getIssueManager()
// Check if Issue Type is Story
if (issue.getIssueType().getName() == "Story" ) {
// Get Custom Field as string (Epic Link)
def epicLinkCf = customFieldManager.getCustomFieldObjectByName("Epic Link")
// Get Custom Field Value as String
CustomField epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link');
String EpicName = issue.getCustomFieldValue(epicLink);
if(EpicName){
// Get Epic from Issue
def epicIssue = issue.getCustomFieldValue(epicLinkCf) as Issue
// Get Fix Version from Epic
def currentValue = epicIssue.getFixVersions()
// Set Fix Version to Story
issue.setFixVersions(currentValue);
}
}
Hello Michael,
Could you please modify above script further for below Scenario:
Create a user story, update a Epic Link ==> Fix Version should be copied from Epic to User Story.
I want to use this with Script Listener, Issue updated Event.
It would be helpful for me and community users.
Thanks in advance.
Suresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suresh,
yes that would be nice, I would like to have this feature too :)
Does anyone can offer a solution for this?
Thanks,
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I think the appropriate solution is to use Script Runner's post function.
You will have to play with it little bit to find out what is the type of value returned for Epic Link custom field etc, but it should work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi thanks for your answer.
Can you help furthermore me with this script? I started but got stuck because I don't know how to copy a field from the linked epic to set it to the user story...
So far I got this:
I got the Epic Issue "Epic", but how can I get the field "Fix Versions" to set it to the User Story?
Thanks again for answering!
Michael
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.CustomFieldType
import com.atlassian.jira.issue.fields.CustomField
import org.apache.log4j.Category
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
def issueManager = ComponentAccessor.getIssueManager()
// Check if Issue Type is Story
if (issue.getIssueType().getName() == "Story" ) {
// Get Custom Field (Epic Link)
CustomField epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link');
// Get Content of Custom Field (Epic Name)
String EpicName = issue.getCustomFieldValue(epicLink);
// Get the Epic by name
Issue Epic = issueManager.getIssueObject(EpicName);
// get content of the epic (field Fix Versions)
// Set Field (Fix Versions) from Epic Story to User Story
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there a means to do the exact opposite? Take all of the child Stories and their Fix Version values and "roll-up" these and set the value of the Epic's Fix Version field?
If the children have a fix version value of:
Issue 1: AA
Issue 2: CC
Issue 3: DD, FF
Then the parent Epic would have a fix version of:
AA, CC, DD, FF
This is basically the "roll-up" function of Portfolio. However, roll-up does not actually write the field (which is unfortunate). I want the stories to be tied to releases and this to drive what Epics show for Fix Version as Epics can and do span releases in my universe.
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.