Reading value of Portfolio for Jira hierarchy in Jira Plugin?

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2019

I want to read value of links created by Portfolio for Jira in Jira plugin. I have check that there is custom field "Parent Link" created by Portfolio plugin but it seems to be not populated and always return 'NULL' value.

I want to read value of parent and child of given issue in Portfolio hierarchy in Jira plugin using Java.

2 answers

1 accepted

0 votes
Answer accepted
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2019

Hello @DPKJ

I am able to use the custom field "parent link" using Jira Java API. I use the value of this field quite a lot in the many scripted fields I have in the script runner plugin.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2019
DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2019

I have looked into that answer.

My issue is what does below code return?

issue.getCustomFieldValue(parentLink);

  Can please tell me type of Object? Is it internal to Portfolio Plugin or is it standard Java issue type?

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2019

This is the exact question I had asked in the link which I posted. The type of object is not documented but it does return the issue key using the ".key()" method. Once you have the key then you can use IssueManager to get the complete issue object and then perform any desired operation on it.

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2019

My problem is I can't add direct dependency to Portfolio so that my plugin can run without it also.

So it is important for me know what type of Object does it return.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2019

Hello @DPKJ

Currently it's an open ticket for parent link to behave link epic link and the Java API for portfolio is also not available yet (REST API is available but not Java)

https://jira.atlassian.com/browse/JPOSERVER-1663

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2019

Thanks.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2019

Hello @DPKJ

If you feel that my answer has helped you, then please accept/upvote so that others are also helped.

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2019

Sure,

I read value using reflection api provided by Java.

0 votes
laralg
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 14, 2019

Hello DPK,

Is the field populated? That field displays the parent issue of the issue you are, if the issue you are searching does not have a parent issue then you will get a NULL.

I recomend setting up the hierarchy, making sure you make a issue parent of another. Add the field Parent Link to the issue, so you can see for sure that, that issue has a parent link. Then start testing, if you have not populated that field first, it is impossible to get a result.

When you add the field parent link, you can even add it to the edit screen to populated  it outside of Portfolio (but remember is a Portfolio field, so you probably need Portfolio permissions)

 

Regards

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2019

Thanks. I have searched for issues where "Parent Link IS NOT EMPTY" and there are some issues and I have run plugin code on those issues, and still I'm getting NULL as output for custom field value.

But I will reverify it on new installation.

Suggest an answer

Log in or Sign up to answer