Hello!
I have a requirement where I need to change the fix version of stories under the epic whenever the epic fix version is changed.
How do I achieve this requirement.
This is on Jira cloud.
Appreciate your response.
try this out, this works for me..
def epicKey = issue.key
if (!epicKey) {
return false;
}
def epicFixVersions = get('/rest/api/2/issue/' + epicKey)
.header('Content-Type', 'application/json')
.asObject(Object)
def issType = epicFixVersions.body.fields.issuetype.name
println(issType)
if (issType!='Epic') {
return false;
}
def fixVersion = epicFixVersions.body.fields.fixVersions.name
def result1 = get('/rest/api/2/search?jql=cf[10003]=' + epicKey)
.header('Content-Type', 'application/json')
.asObject(Object)
def resulttotal = result1.body.total
for (def i=0;i<resulttotal;i++)
{
def isStatus = result1.body.issues.fields.status.name.value[i]
if("$isStatus" != "Done" || "$isStatus" != "Closed")
{
def result = put('/rest/api/2/issue/' + result1.body.issues.key[i])
.header('Content-Type', 'application/json')
.body([
fields:[
fixVersions: [[name:fixVersion[0]], [name:fixVersion[1]], [name:fixVersion[2]]]
]
]).asString()
}
}
}
You can do this with Script runner for Cloud. Here's the sample code. Basically you would need to use script listener to list for fixVersion change events and then update the same version on child stories.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your reply but I do not understand what you are trying to pull when you say the below in the first line
customfield_10003
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok I now get it that the epic-name is being found at the customfield_10003 but this holds good when a story is created for an epic and the fix version is set automatically.
But, my original requirement was, whenever EPIC fixVersion is changed, all the associated stories fix version should change. This does not work with the given script.
Any help on achieving it is much appreciated :)
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.
Were able to resolved it. I am facing the same issue. Thanks in advance.
Regards,
Deepali Bagul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Deepali Bagul
The code in the link is the exact sample of what needs to be done, can you please share what is the problem that you are facing?
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.