• Community
  • Products
  • Jira Software
  • Questions
  • How do I deactivate an existing component so it can not be used anymore but I do not want to delete it since the historic (its usage) must not be lost.

How do I deactivate an existing component so it can not be used anymore but I do not want to delete it since the historic (its usage) must not be lost.

René Blouin December 10, 2015
 

3 answers

1 accepted

3 votes
Answer accepted
Wazza
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 10, 2015

Hi @René Blouin,

Unfortunately it's not possible to do that. If you delete a component, you have the option of either assigning all issues with that component to a different component, or deleting the component from those issues. Feel free to raise a suggestion in our JIRA instance to add this functionality.

I can think of one work around off the top of my head, you could maybe consider adding a custom field (such as a label field) that you could then add the original component detail to for historical tracking? You would need to bulk add the details to the issues that had the original component before deleting it, as the component will be removed from the issues on deletion. If you make sure the field isn't available on any screens, your users won't be able to add or delete from the field, but you can still run searches and queries on it. It's a manual workaround, and depending on your requirements it may not be worth it, but it is an option.

Thanks,

Warren

René Blouin December 11, 2015

Hi, I wanted to make sure I was not missing it before using a workaround since what I am looking for is exactly the same thing arleady implement with the Custom field of type "Select List single choice" where there is a disable option, which only makes it invisible in the drop down list. I will raise the suggestion in your Jira instance. Thank you very much! René Blouin

Like Rolf Lader likes this
2 votes
jpins February 14, 2019

Here is a Javascript implementation. Removes any options with "(Inactive)" (case-insensitive) in the title of the Component.

Place in the Component Description in the Field Configuration of your target project.

This works on Create/Edit screens, as the Description is displayed. But will not work on inline editing of Components.

 

<script>$('#components').children('option').filter(function() {return this.title.match(/\(inactive\)/i);}).remove();</script>
Aron Felberbaum June 28, 2019

This script did not work for me,

Added inactive to component description and added the java script in the Description of the Field Configuration.

Version 7.13.3

jpins June 28, 2019

Hi Aron, "(Inactive)" needs to be in the Component Name, not the description. 

Also, Archiving Components is available in newer versions of Jira:

https://confluence.atlassian.com/adminjiraserver/archiving-a-component-968669976.html

1 vote
Damian Rosochacki November 28, 2016

Although this is already answered, I figured I'd share my solution also. 

Because for my use case I was only concerned with not using legacy components while creating new tickets, I used a script validator on the Create transition (using Script Runner) to prevent using any component that had "(L)" in its name:

import com.opensymphony.workflow.InvalidInputException
import org.apache.log4j.Category;
log.setLevel(org.apache.log4j.Level.DEBUG);
 
String error = "";
for (int i = 0; i &lt; issue.componentObjects.size(); i++) {
 if (issue.componentObjects.getAt(i)?.getName().matches(/.*(\(L\)).*/)) {
 throw new InvalidInputException("components", error); } }

When I want to "archive" a component, I just add the "(L)" in the beginning of its name, e.g., (L) API

 

 

Suggest an answer

Log in or Sign up to answer