Hello Everyone ,
I am using jira software cloud. and I want epic key from its story and task issue. How can I get this key using scriptrunner for jira cloud
OR
I want to update the epic custom field value on transition update of the its task issue
How can I do this ?
Regards,
Chinmay
Hello @chinmay konkar
Welcome to the community.
You can use the Automation feature of Jira Cloud to create a rule that is triggered by the transition update of the task. You can add to the rule a Branch to affect the Related Issues = Parent Epic, and then you can add an Action to the rule to make the change you want in the Epic.
Here is the home page for the documentation on the Automation feature:
I hope you are doing good.
As per your enquiry, we have an example of how to set field values in the script and then to run the Get Issue Fields example script on the Script Console as this will return the JSON structure for the issue and show how the data is stored for the field. Then, you can get the epic issue using the Epic Link Field.
Example:
def issueKey = 'TP-1'
def result = get('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.asObject(Map)
if (result.status == 200){
return result.body.fields
} else {
return "Failed to find issue: Status: ${result.status} ${result.body}"
}
Also, you can use the EPIC Link to get the key to the epic. We have an example to show you how to obtain the epic name and key here. You can use this as a guide and modify it to achieve your requirements.
Hope this will help.
Thank you.
Kind Regards
Kate
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kate Kabir
Thanks for the reply. I am able to get the epic key from its linked story.
But I am not able to get the story key from its (story's) task. How can I get this story key? OR I am not able to get the epic key from task. How can I get this story key?
Basically the hierarchy is :
sub-task is linked to task, task(with its sub-task) is linked to story, and story(with its tasks and subtask) is linked to epic
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.