Structure custom column: Get value from linked issue?

c7788 January 10, 2018

Hello. In my Structure, I would like to add a column that displays a value from the task's linked issue. Is it possible to do this as a custom column in Structure?

For example:

Task A is linked to Task B via 'is a User Story for'

Task B has a custom field called 'Department' with a value of 'Research'

Task A is in my Structure. I would like to add a Department column that would show 'Research' next to Task A.

 

Thank you.

1 answer

0 votes
Egor Tasa [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.
January 11, 2018

Hello,

Yes, this is possible if the issue is in the structure. Since version 4.3, you can use PARENT{} aggregation function to call some field from the parent. Alternatively you can select JOIN{} or SUM{} functions to pick values from children. Note that in a structure graph there is always one parent to an instance of an issue, but there can be more than one child. Thus only PARENT{} returns single value. 

Here is some documentation about aggregation functions.

If you want to reference any issues that may or may not be in the structure, but are linked to an issue in the structure, you'd have to use Script Runner custom fields, but this would require formulation of a criterion how value is selected, as there can be more than one parent as well as more than one child with the same link type in Jira.

Please, let me know if aggregation functions satisfy your requirements. And if you need a script runner field, please, let me know the criterion how you select Task B from tasks linked to Task A, and I'll see if I can provide an example of groovy script.

Regards,
Egor Tasa
ALM Works Support

Jordan_Janis August 19, 2019

Hi Egor,

I have a question that seems similar.  I have a structure that shows a list of Features (we have Portfolio for Jira) and the children of those Features.  The children are established by the Parent Link field provided by Portfolio.

I have extended the Structure to also pull in issues that have a specific link type/direction ("requires").  So any issue that is required by a Feature also shows up as a child in Structure.  Those linked issues willl be children of other Features.

To be clear, here's an example:

  • EPiC-123 --- Parent Link ---> FEAT-345  and
  • EPIC-987 --- is required by ---> FEAT-345 and
  • EPIC-987 --- Parent Link ---> FEAT-654

 

What I want to do is create a formula that will zero out the story points of EPIC-987 only when it appears as a child to FEAT-345.  Generically, I want any issue that is not a direct descendant (Parent Link) to have their points zeroed out when shown in Structure.  

Is this possible?  Is there a way to examine link type in the Structure Expr Language?  We also have ScriptRunner available to us but not clear on how I can combine the two.

Thanks for any insights you can offer.

Regards,

-jj

Egor Tasa [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.
August 19, 2019

Hi Jordan,

The formula would depend upon what you want to do with the results eventually, but if you just need to display zeroes in Structure table, not use them in summing up the tree, you can use formula IF(PARENT{key}="FEAT-345" and key="EPIC-987"; 0; storypoints). However, I have a feeling that you need it either to remove duplicates (which formula aggregations already do automatically unless you use #all modifier, and summary columns can be set to do) or want to participate in other aggregation, which will not work at the moment. Sorry for having to guess, but the context of the reference in this case is important.

Regards,
Egor
ALM Works

Ondrej_Tomcik February 10, 2020

Hello @Egor Tasa [ALM Works] 

Following your comment:

> If you want to reference any issues that may or may not be in the structure, but are linked to an issue in the structure, you'd have to use Script Runner custom fields, but this would require formulation of a criterion how value is selected, as there can be more than one parent as well as more than one child with the same link type in Jira.

 

I am trying to find a way how to display the linked issue name in the column, which is not part of the structure. Can you please guide me how can I achieve that?

Egor Tasa [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.
February 10, 2020

Hi Ondrej,

You can create a custom field with the help of ScriptRunner or Power Scripts. Here is an example:

import com.atlassian.jira.component.ComponentAccessor

//Get necessary managers
def cfm = ComponentAccessor.customFieldManager
def linkManager = ComponentAccessor.issueLinkManager


def issueKeys = []
//Go through all linked issues and collect their keys if link is of specified type
linkManager.getInwardLinks(issue.id).each{
def linkedIssue = it.sourceObject

if(it.linkTypeId==10000)
{
issueKeys.add("${linkedIssue.key}")
}
}

if(issueKeys.size() > 0)
{
return issueKeys.join(',')
}
else
{
return null
}

This should collect all issues connected via "blocked" link.

Regards,
Egor

Ondrej_Tomcik February 12, 2020

Thanks for quick reply @Egor Tasa [ALM Works] .

I finally figured out how to do it, thanks to your groovy script. Thanks!

 

One more question, If I know display this column in the structure, I would like to open the link in the grid details. So not open it on a new page, but on a detail view. Is it possible?

 

Currently the content of the custom field is:

<a style="border-radius: 5px;padding-left: 5px;padding-right: 5px;background: #6554c0;color: #ffffff;text-align: center;vertical-align: middle;" href="https://jira.example.com/browse/ABC-6019">Log Sinks</a>

c7788 November 25, 2020

Hello @Egor Tasa [ALM Works]  - I have a new use case. It looks like the documentation describes adding the text values of a field. Can this be done with an image field? For example:

 

A row of my Structure is an Epic. I wish to display an image field from a child of the epic, on the Epic's row. The child is part of the Structure.

Egor Tasa [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.
November 26, 2020

Hi @c7788 this depends on what does image field return as a text value. If it is image's URL, then certainly it is possible to use wiki-markup with Formula.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events