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.
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.
https://michaelheap.com/jira-cloud-scriptrunner/
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
<span>customfield_10003</span>
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
@Tarun Sapra can anyone please help?
@Deepali Bagul
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.nameprintln(issType)if (issType!='Epic') { return false;}def fixVersion = epicFixVersions.body.fields.fixVersions.namedef result1 = get('/rest/api/2/search?jql=cf[10003]=' + epicKey) .header('Content-Type', 'application/json') .asObject(Object)def resulttotal = result1.body.totalfor (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() }}}
It looks like you're new here. Sign in or register to get started.