scripted field in linked issue to show values from Epic

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

This widget could not be displayed.

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
}

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))
}

 

 

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

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)

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

 

This widget could not be displayed.

.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published yesterday in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

165 views 0 13
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you