Working with IssueLinkManager without history entries

Tomáš Vrabec August 30, 2022

Hello community, 

I am in front of optimizing an routine job done in script runner. 

Basically, every night, it compares some custom fields with set off issues and recreates issue links between true findings. 

Thats working fine and as expected, the problem is, when users tries to reach the issue history.

Its flooded with system automation user entries of removing / recreating links.

My idea is, to 

  1. Do not write history at all, but whole script is based on issueLinkManager.createIssueLink and issueLinkManager.removeIssueLink methods where I cannot find any way how to not write a history event.
  2. After running the routine, at the end, run clean-up of history - simply remove all history event caused by system automation user, which perfectly fine by business need.

Any ideas how to achieve at least one of those?

Thanks, Tom

1 answer

0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 31, 2022

I am not aware of a way to create issue links using lower level API that don't also create the history. You'd need to get into some pretty complexe "OfBizDelegator" methods. You can always go explore the source code for the DefaultIssueLinkManager class (you should have access to the jira source code from your license page) to see how Jira does the createIssueLinke and removeIssueLink. 

And I am not aware of a method to selectively remove history items (you can only delete the entire history for an issue, that is designed to clean up the history when you delete an issue).

My suggestion would be for your script to be smarter and only perform the absolutely necessary operations. Before adding a link, validate that conditions that would cause it to be removed later are not true. Before removing it, do the reverse validation.

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 31, 2022

I actually just accidentally came across: https://docs.atlassian.com/software/jira/docs/api/8.13.15/com/atlassian/jira/issue/link/DefaultIssueLinkManager.html#removeIssueLinksNoChangeItems-com.atlassian.jira.issue.Issue-

But it won't help you with the creation part.

And it removed ALL the issue links. As stated in the javadoc, this is intended to be paired with a delete issue operation.

Tomáš Vrabec September 1, 2022

Yup, I find that one as well. The trouble is, that the issue is very complex part of SAFe automation, so the root issues do have up to 50 links from 6-7 different link type. 

The troubling automation do working with only 1 particular link type. 

Well, customer is 15k+ DC priority tier, so I will try ask Atlassians as well. 

Figured out, that even Tempo guys do have this issue, but with history spammed with logtime records in long terms tasks. Will keep this issue updated. 

Suggest an answer

Log in or Sign up to answer