scripted field in linked issue to show values from Epic

Tobias Albrecht February 2, 2017

Hi,

I'm looking for a solution  with scriptrunner to have a scripted field inside a feature which is linked to an epic that shows me the value of a customerfield (e.g. textfield) in a/all linked feature/s.

So in the Epic there would be e.g. a customerfield with value "Target Release" and I want to have this"Target Release" reflected in according linked issues.

Would be great if anybody could support me on this

regards

Tobias

 

2 answers

1 accepted

0 votes
Answer accepted
JamieA
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.
February 2, 2017

Assuming Target Release is a Version custom field, you'd use something like the below.

For the script field use Text template and Exact text searcher. Version templates and searcher are coming in the next release.

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.project.version.Version

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def epicLinkCf = customFieldManager.getCustomFieldObjectByName("Epic Link")
def targetRelCf = customFieldManager.getCustomFieldObjectByName("Target Release")

def epicIssue = issue.getCustomFieldValue(epicLinkCf) as Issue
if (epicIssue) {
    return (epicIssue.getCustomFieldValue(targetRelCf)?.first() as Version).name
}
Tobias Albrecht February 2, 2017

thanks a lot for supporting my first steps smile

 

here is the solution that worked for me with a textfield (customerfield)

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.project.version.Version


def customFieldManager = ComponentAccessor.getCustomFieldManager()
def epicLinkCf = customFieldManager.getCustomFieldObjectByName("Epic Link")
def epicIssue = issue.getCustomFieldValue(epicLinkCf) as Issue
def targetRelCf = customFieldManager.getCustomFieldObjectByName("FB Target from Program")


if (epicIssue) {
    return (epicIssue.getCustomFieldValue(targetRelCf))
}

 

 

pragati bhatia April 19, 2017

Hello,

Can the same work for Structures also? 

 

I am looking for the same solution for the structures created, For eg, I have a fiels "Fix Versions" and few more text fields , can these field be inherited in the structure from the parent?

Could someone support on this?

Thanks in advance.

Pragati

Eugene Sokhransky _ALM Works_
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.
April 20, 2017

Hello Pragati,

It's possible to do the same for structure, but doing that in real time will not be very efficient in terms of performance. Running such a script once in a while to update the fields will work much better, if such an approach works for you.

Please let me know if that's an option and we'll provide some guideline for implementing this.

Regards,

Eugene (ALM Works)

pragati bhatia April 20, 2017

Hello Eugene

Thanks for your response. What can be the frequency of running the script? 

Also, could you also send a sample script for doing the same for structure (in real time). As per the use case, it is more desirable to have the real time implementation.

However if script frequency is such that the users are not impacted much, we could think of implementing that as well.

Many thanks

Pragati

 

0 votes
Alarm.com IT July 24, 2017

.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events