Hide certain components in Jira

Jurica Petricevic
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.
February 15, 2021

In a good part of our projects, the allocation of Issues happens through components, but also the allocation of subtasks. The components used to assign a Issue to someone in the Subtask should be hidden when creating a Issue.

only some selected components need to be hidden. hidden components have the same name across all projects and projects use the same workflow.

 

We have automation, JMWE of tools for something like that. Can someone help me?

 

Best regards

Jurica

2 answers

0 votes
Thorsten Letschert _Decadis AG_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 16, 2021

Hi @Jurica Petricevic ,

components are related to the project and not the issue type(s), so you're not going to be able to 'hide' certain components for certain issue types.

If you want to restrict a field to your sub-tasks, you should consider switching to a dedicated custom field and restrict its usage/availability to your sub-tasks. While the assignment might get a bit more complex (no more assign to component lead' but 'if option A then assigned B, if option C then assignee C, etc.) I don't see another option here.

Cheers
Thorsten

Jurica Petricevic
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.
February 18, 2021

This is the more difficult solution than the one we currently have. For now, the project has already come to life like this. I hope to find some solution how to hide the peeled components in the jira.

0 votes
mogavenasan
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.
February 15, 2021

Hi @Jurica Petricevic,

I'm assuming that you are using the Component's Default Assignee. Unfortunately, it's not possible to exclude Subtask from the Component's Default Assignee.

However, since you have automation, maybe you can consider implementing the default assignee based on Component via automation(not sure which Jira apps you are using) or JMWE(Workflow post-function - Set field value).

I hope that this helps.

Thanks,
Moga

Jurica Petricevic
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.
February 15, 2021

there are 3 components in each project that serve as a type of Issue assignment but also a viewer of done subtasks. It was one big problem and it should stay that way but it should also be hidden when creating the main ticket. I use these components in Automation rules and no one else should see them. but I cannot hide them in Jira.

 

Thanks for your help.

mogavenasan
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.
February 16, 2021

Hi @Jurica Petricevic,

I'm quite confused here, if you want to hide the Component field, then no users can fill in the field value and the Automation rules are not going to be triggered.

Would you be able to elaborate more on this?

Jurica Petricevic
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.
February 18, 2021

these components are used only by automation. No user needs to do anything with them and they don't need to be seen. I use automation in such a way that when the main ticket changes the status, I create subtasks which then get this component and then belong to a certain assignee. 

 

I just don't want those 3-6 components to be seen when creating the main ticket.

mogavenasan
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.
February 18, 2021

Okay, from what I can understand so far is that, you do not want anyone to fill in the Components field for the Subtask issue type except via Automation.

  1. What if you remove the field from the screen? Will the Automation complain about it?
  2. One more way would be to hide the field using Scriptrunner behaviour.
Jurica Petricevic
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.
February 18, 2021

I need that field. I need a component field because the Users needs / should choose one from the list where there are 4-5 of them that are suggested to him, but there are also  notneeded once on that list, they shuldnt be shown, 3-6 Components i mentioned earlier.

mogavenasan
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.
February 18, 2021

I'm sorry, I'm having trouble understanding your requirement. What you are looking for is; during the issue creation/edit, you would like to show a subset of the Components list?

If yes, then you will need a Jira app like Scriptrunner - the script would be something similar to Restricting Priority And Resolution

Jurica Petricevic
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.
February 18, 2021

That's exactly it. I need only the desired components to be displayed when creating a ticket, just like on this link. We also have Scriptrunner available for use in our company.

 

is there a chance we can try to make code together?

 

I think a good option would be to make sure that components called SSK and ORG are not shown. In all projects, the unwanted Components are called the same.

mogavenasan
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.
February 18, 2021

Okie dokie, I will come up with a working code tomorrow. It's night time here. :D

Like Jurica Petricevic likes this
Jurica Petricevic
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.
February 22, 2021

do we have any progress here? 

mogavenasan
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.
February 22, 2021

Apologies for the late reply. I totally forgot about this. There you go:

import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.COMPONENTS

def projectComponentManager = ComponentAccessor.getProjectComponentManager()
def components = projectComponentManager.findAllForProject(issueContext.projectObject.id)

getFieldById(COMPONENTS).setFieldOptions(components.findAll { it.name in ["Component 1", "Component 2"] }) 

You can change options in ["Component 1", "Component 2"] to your preference.

Do let me know if there is anything else I could you with.

Jurica Petricevic
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.
March 28, 2021

Hello,

 

this is totally the opposite but still useful.

I need not show 3 components that are common in all projects and here I can hide individual ones.

Whether there is a way to change this script so does she not show the component ssk 1, ssk 2, ssk 3. All projects share these three components but each of the 150 projects has its own specific components that I do not want to enter manually here because in some there are also 150 of them.

 

Best regards

Jurica

Suggest an answer

Log in or Sign up to answer