Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to restore Child issues links after disabling Portfolio?

Jeff Turner
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.
Sep 08, 2019

Portfolio lets one group tasks into Initiatives. This hierarchy is visible in the Portfolio Roadmap page, but also when you view the Initiative issue - one sees a 'Child issues' section with the initiative's tasks.

Let's say a company migrates off Portfolio. They disable the plugin, or let its license lapse. What happens to those 'Child issues' links visible on the Initiative issues?

Sadly, they disappear. Despite looking like regular Jira issue links, they are not.

Is there a way to get those Initiative-Task links back?

1 answer

1 accepted

0 votes
Answer accepted
Jeff Turner
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.
Sep 08, 2019

(ask-and-answering my own question, SO-style, so it's documented)

Issue links created by Portfolio aren't stored in the issuelink database table as usual. Instead, they are stored as JSON in the entity_property table.

With Postgres, you can get a list of child-parent ID links with this SQL:

 

select entity_id AS child_id, (json_value::json->>'parent_id')::numeric AS parent_id from entity_property where entity_name='IssueProperty' and property_key='jpo-issue-properties';

The missing issuelink records can be created from this JSON as follows:

-- https://www.redradishtech.com/pages/viewpage.action?pageId=14483457
begin;
create temp sequence issuelink_seq start with
99999; -- https://stackoverflow.com/questions/37057643/postgresql-starting-a-sequence-at-maxthe-column1
select setval('issuelink_seq', (select max(id::bigint)+1 from issuelink));
WITH jpolinks AS (
    select entity_id AS child_id, (json_value::json->>'parent_id')::numeric AS parent_id from entity_property where entity_name='IssueProperty' and property_key='jpo-issue-properties')
, newissuelinks AS (
  select nextval('issuelink_seq') AS id
        , jpolinktype.id AS linktype
        , parent_id AS source
        , child_id as destination
        null::numeric AS sequence
  from jpolinks
    CROSS JOIN (select id from issuelinktype where linkname='Parent-Child Link') jpolinktype
  
where parent_id is not null -- the parent_id JSON is sometimes empty
    and not exists (select * From issuelink where source=parent_id and destination=child_id and linktype=jpolinktype.id) -- don't double-insert
)
insert into issuelink select * from newissuelinks;
update sequence_value_item set seq_id=nextval('issuelink_seq') where seq_name='IssueLink';
update issuelinktype set pstyle=
null where pstyle='jira_jpos_parent_child'
;commit;

Full gory details on this blog post.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events