How to get a CustomField Value from a Linked Issue

Hello eazybi team and community,

I am pretty new to eazyBI, so please excuse me if I totally overlook something.

I have a parent issue called ANDE and this ANDE issue has several linked issues. In most cases, a SYS issue, CM issue and one or two LINIE issues. One of these LINIE issues is open and not canceled. My Import Setting is all Issues from the ANDE Project (only Parent Issues).

I have managed to display the key of the LINIE issue that is not closed.

What I still need now is value of the custom field called “bundle number” from this LINIE issue.

My code which I entered in the Settings -> Advanced Settings to get the non-canceled LINIE issue IssueKey:

[jira.customfield_verlteillin]
name = “Verlinkte Teilaufgaben LINIE”
data_type = “string”
dimension = true
multiple_values = true
split_by = “,”
javascript_code = ‘’’
var issuelinks = new Array();
if ( issue.fields.issuelinks ) {

var links = issue.fields.issuelinks;
for (var i = 0; i < links.length; i++) {
var link = links[i];

if (link.outwardIssue) {
    if( link.type.outward == "has Task" && 
       link.outwardIssue.key.indexOf("LINIE-")>=0
       ) {
      issuelinks.push(link.outwardIssue.key);       
    }
}
}

issue.fields.customfield_verlteillin = issuelinks.pop(",");
}
‘’’

My Question is: How do I get the value in my report from the Customfield “bundle number”, which is in the LINIE issue? The Linktype is “has Task” Example: ANDE-1234 has Task LINIE-1234 (The ANDE issue creates the LINIE issue) LINIE Issues are not sub-tasks.

Greetz
Ersin

1 Like

Hi @Ersin

I see you have figured out how to import issue links using Javascript in advanced settings. Nice.

However, there is also one easier approach (with less lines in the code) to import linked issues:
https://docs.eazybi.com/eazybijira/data-import/advanced-data-import-options/import-issue-links
Depending on the use-case you could try using both approaches.
If you need import linked issues just from a specific project.

In this case, the answer is in MDX side.

After you have imported linked issues in new dimension and imported your numeric custom field “Bundle number” as measures, you could use the MDX function GetMembersbykeys to extract the custom field values from your linked issues using imported properties and new dimension members.

CASE 
When
  [Issue].CurrentMember.Level.Name = "Issue"
  AND
  [Verlinkte Teilaufgaben LINIE].Currentmember is [Verlinkte Teilaufgaben LINIE].Defaultmember
Then
  Case when
    not isEmpty([Issue].CurrentHierarchyMember.Get('Verlinkte Teilaufgaben LINIE'))
  then
    NonZero(SUM(
    [Issue].[Issue].GetMembersByKeys(
      [Issue].CurrentHierarchyMember.get('Verlinkte Teilaufgaben LINIE')),
      DefaultContext((
        [Measures].[Bundler number created],
        [Issue].CurrentMember
        ))
    ))
  end
Else
  NonZero(SUM(
    Filter(
      Descendants([Verlinkte Teilaufgaben LINIE].Currentmember, [Verlinkte Teilaufgaben LINIE].[Verlinkte Teilaufgaben LINIE]),
      ([Measures].[Bundler number created]
        ) > 0),
    DefaultContext((
      [Measures].[Bundler number created],
      [Issue].[Issue].GetMemberByKey([Verlinkte Teilaufgaben LINIE].Currentmember.Key),
      [Verlinkte Teilaufgaben LINIE].DefaultMember
    ))
 ))
End

Martins / eazyBI support

Hi @martins.vanags,

thanks for your help and the information.

The problem is, the “Bundle Number” field is unfortunately not a NumberField but a text field. Because the “Bundle Number” contains letters.
As far as I know I import Textfields as Properties. Is that correct?

Can I also use MDX function GetMembersbykeys? Do I have to replace [Measures] with [Properties] in your code?

Thanks for your help :slight_smile:

Best Regards

Hi,

Can there be only one linked LINIE issue per each main issue?

Otherwise, how are you planing to return results for Bundle number in case when there are two linked LINIE issues (or even more than 2)? If that is not the sum, is it perhaps a comma separated string?

Martins / eazyBi support

Hi @martins.vanags,

sometimes (in very few cases) there are two linked LINIE issues. One is canceled (Resolution: Canceled) and closed (Status: Closed). The other one is still in progress and not closed. The not closed LINE issue is the most important one.

To get this one I use “issuelinks.pop()” because the LINIE issue with the highest issue number is always not the closed one.
For Example linke issues: “LINIE 125, LINIE 4182”
LINIE 125: Close and Canceled.
LINIE 2763: open or in progress and has a Bundle Number and value looks like “LINIE_4182_3254_3196”

In the most cases the closed (Status: Closed) and canceled (Resolution: Canceled) LINIE Issue does not have a Bundle Number.

Best Regards
Ersin

Hi,

In query language, you can’t use “most cases” when defining exact steps for calculation. Either there is one LINIE, one LINIE with bundle or there can be more than 1 with bundle number across the imported data set, the calculation should be prepared for all possible scenarios, or data should be cleaned in Jira.

For example:
There is one main issueA with two linked issues (LINIE 1 and LINIE 2).
And each of those 2 issues LINIES has Bundle numbers (Bundle 1 for the first and Bundle 2 for the second)
How the report then should display them in the report (assuming this is not one of the most cases)?

Martins / eazyBI support

Hi @martins.vanags,

I understand.

I looked at the issues. And we only have one case where a Closed and Canceled LINIE issue has a bundle number. It is one of 12000 LINIE issues.

It would be okay if the bundle number of the canceled is shown in a comma separated string.

For Example: Main Issue A has linked issues: “LINIE 125, LINIE 4182”
Column in report: Bundle Number: “LINIE_125_254_126, LINIE_4182_3254_3196”

Best regards and thanks for your time

Ersin

@Ersin

Try this formula

CASE WHEN
[Issue].CurrentHierarchyMember.level.Name = "Issue"
AND
Not IsEmpty([Issue].CurrentHierarchyMember.get('Verlinkte Teilaufgaben LINIE'))
THEN
Generate(
[Issue].[Issue].Getmembersbykeys(
  [Issue].CurrentHierarchyMember.get('Verlinkte Teilaufgaben LINIE')
),
[Issue].CurrentHierarchyMember.key ||"_"|| Cast ([Issue].CurrentMember.get('Bundle Number') as string),  ', '
)
END

It would return all bundle numbers for each issue who has linked Linies,
But this would work only for issue level members from “Issue” dimension.
As you can imagine, you can’t aggregate totals as the bundle number is a string value.

Martins / eazyBI support

I THINK I’m trying to do the same thing @martins.vanags but more basic, I hope?? I have issues in project A that use 'Issue Link" and i just want those issues, the assignee and their version to appear. whats the easiest way to do that?

Hi @joey

The concept is the same. You would need to import linked issues and then create calculated measures to find the assignee, version etc for linked issues.

Martins / eazyBI support

Thanks @martins.vanags , can you help me with the formula? i don’t even know where to start.

Hi @joey
You could start by importing linked issues as described here:
https://docs.eazybi.com/eazybijira/data-import/advanced-data-import-options/import-issue-links

After importing linked issues, make sure that both projects are selected for import.
Then you could create new calculated measures that find the assignee, version from linked issues.

Martins / eazyBI support