Hide some link types from issue link screen

Pumper1 March 15, 2018

Hi,

I have many lik types in my jira, but i wont to hide some of them from issue link screen.

How i can do it? I have script runner and behaviour plugin.

2 answers

1 vote
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 30, 2018

I found a way to do this without using a plugin for Jira.  I found a related post on this in https://community.atlassian.com/t5/Answers-Developer-Questions/Hiding-Issue-Links-on-create-screen/qaq-p/492222

In that case, the user wanted to do this, but only for certain projects.   I was able to take his javascript and change it a bit so it can be a global change.  Note, this only hides those specific options from the link type field.   But also I had to update the AJS element name, as newer versions of Jira are using a different element name for this.   I tested this with my Jira 7.8.1 instances and this works.

<script type="text/javascript">
jQuery(document).ready( function($) {
    var removeCTE = setInterval(function() {
if (1==1){
AJS.$("#link-type.select option[value='causes']").remove();
    }},1000);
    var removeCTE = setInterval(function() {
AJS.$("#link-type.select option[value='clones']").remove();
    },1000);
    var removeCTE = setInterval(function() {
AJS.$("#link-type.select option[value='relates to']").remove();
    },1000);
});
</script>

With this script added to the announcement banner, I was able to hide the causes, clones, and relates to link types from appearing as an option here.   Thanks to @Alon Kogan for the source.

 

Please note, this only hides the options in the browser of the end user.  It is still possible that a plugin or an API call to Jira could still create links of these types.

Antônio Duarte July 7, 2018

It solves part of the problem because it is effective only on pages where the banner is shown.

If the user clicks on 'Create Linked Issue' menu option (see image below), then the undesired link types are presented in the link selection field at the edition pop-up window and are available for selection.

Any solution for this, please?

Thanks in advance

linkissue.jpg

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 9, 2018

Hi @Antônio Duarte

The create linked issues is a different (but related) feature to the linking issues together.  As such it actually has different names for the elements in question.   I was able to use the browser developer tools in Chrome to find out the name for these elements as 'issuelinks-linktype'

With this information, I was able to tweak the previous script to block both:

<script type="text/javascript">
jQuery(document).ready( function($) {
    var removeCTE = setInterval(function() {
AJS.$("#link-type.select option[value='causes']").remove();
AJS.$("#issuelinks-linktype.select option[value='causes']").remove();
    },1000);
});
</script>

This example will block the 'causes' link type in both the 'create linked issues' and the 'links' creation menus.

0 votes
Blaise Rey-Mermet March 2, 2023

Hi! We had to hide only the "Child Issues" link types. This is possible using Fragments, since they are on a separated panel. I added the details in this post  https://community.atlassian.com/t5/Jira-questions/Hide-quot-Child-Issues-quot-section-in-the-issue-view/qaq-p/1978149#U2286721   

Suggest an answer

Log in or Sign up to answer