Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get fix Version of Epic from its Story ?

Ofira Daniel
Contributor
August 5, 2018

Hi ,

 

I would like to check if story fix version is equal or different from its Epic fix Version .

 

Any idea how to do it ? 

 

Will be happy to get suggestions 

1 answer

1 accepted

2 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2018

Hello,

If you want to do it in a post function, your code would look like this:

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;


CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link');
Issue epic = issue.getCustomFieldValue(epicLink) as Issue;
log.error(epic.getFixVersions())
Ofira Daniel
Contributor
August 7, 2018

thanks a lot

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 7, 2018

You are welcome!

Ofira Daniel
Contributor
August 12, 2018

Hi ,

I have small question , and will be happy if you can assist me 

I adjust the code to work as script listener -

1) script called when issue updated 

2) I am failing to get previous fixVersion value , it always null 

 

I tried both below w/o luck :

1) 

nameOfUpdatedField = "Fix Version"
def changeFixVersion = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == nameOfUpdatedField}

2) 

ChangeHistoryManager changeHistoryManager;
List<ChangeItemBean> changeList = changeHistoryManager.getChangeItemsForField(issue, "Fix Version")

Thanks in advance 

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2018

You should add logging to your script. And have a look what is wrong

Ofira Daniel
Contributor
August 13, 2018

thanks , working on it 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events