Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get epic issue key and story issue key from its task issue

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

2 answers

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:

https://support.atlassian.com/jira-software-cloud/docs/automate-your-jira-cloud-processes-and-workflows/

Hi @chinmay konkar 

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

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

947 views 2 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you