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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can you bulk disable custom field values from within Jira?

I have a scenario where several hundred field values need to be disabled for a multi-select list custom field in Jira. Is there any way to bulk disable custom field values within the Jira interface, perhaps with Scriptrunner?

Or, is disabling values one by one the only way to handle this from within Jira?

Thanks!

Andrew

 

 

2 answers

0 votes

Hi @Andrew Zimmerman 

Can you explain your use case a bit in detail?

Using ScriptRunner you can create a behaviour to disable those values or split the custom field contexts and few more things as well with a custom script.

Ravi

Hey @Ravi Sagar _Adaptavist_

Sure thing. Essentially the custom field is a multi-select list of our customers over the years. We formatted it this way so that users would not make errors in spelling or use inappropriate shorthand/abbreviations when referring to customers. With a select list, we can ensure the customer names on tickets are always spelled the same way, we can use the values in logic, and VLOOKUPs with data manipulation from reports from other systems, etc. 

Because this field is available in many of our Jira projects and because it's considered the standard authoritative source for customer names in Jira, it only has one, global field context.

Over the years it's become extremely bloated as lapsed customers or accounts that are no longer active are still selectable. We still need their values in Jira to query and report on, but they will not be newly selected, so I'd like to disable them to clean up the current selectable list for end users.

I have a CSV of exactly the custom field value options that need to be disabled, exactly as they are spelled in Jira. Since it's several hundred values, I'd love to be able to import that list and have Jira disable any value that matches for my specified custom field, rather than doing so one by one in the Custom Field>Edit Options page.

But, that's where I'm stuck. I'm not sure such a thing is possible within the Jira UI.

Hi Andrew, I have a similar scenario. Were you able to figure it out?

Hey @Jaswanth Padigala !

I wasn't able to find a solution that utilized my CSV list. But, @Merita Bushi, another admin on our team, discovered that you don't have to wait for the enable/disable/edit request to resolve in your main "edit options for custom field" screen if you open in a new tab.

So, I'm able to get through these pretty quickly by simply command+clicking (I'm on a Mac) on the "Disable" option as I scroll down the custom field value options.

I can't completely vouch for safety of this method regarding system performance, although I haven't had problems. You may want to monitor your CPU or perform this task outside of prime business hours just in case. I was just tired of waiting for the value option list to refresh after every single edit or disable action. Since the total list is so long, it would take 15s to refresh after making an option edit, disable, or enable and when you have to edit or disable 100 options, that really adds up.

Hopefully this helps a little,

Andrew

Thanks Andrew. Not a bad approach if we can spend few minutes. I will try it. I have about 500 values to disable and was planning to write a SQL script to set the 'disabled' flag to 'Y' in customfieldoption table. 

It would be great if scriptrunner or Atlassian themselves provide some solution to this.

Right, yeah with 500 it'll take a bit done manually. Sounds like you're going to work through this method and have already seen this page, but linking it here just in case!

I scanned through some developer docs but couldn't figure out how to do what I was searching for. I came upon a few potentially related tickets, but one is already resolved as won't do.

https://jira.atlassian.com/browse/JRASERVER-41661

https://jira.atlassian.com/browse/JRASERVER-60274

There could very well be a useful fragment in the Scriptrunner Library. I just couldn't find it and decided to start going through the list manually. 

If you go with the SQL script route, I'd be interested in hearing how it turns out and if the process was relatively straightforward or not.

Take care,

Andrew

I was able to use this to disable options from a customfield. I can't remember what kind of customfield it was but it may lead you to the right place. This script was used in the Script Console

 

import com.atlassian.jira.component.ComponentAccessor 
//Any ticket number can be used that has the targeted custom field
def issue = ComponentAccessor.getIssueManager().getIssueObject("JA-iiii")
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Custom-field Name")
def optionsManager = ComponentAccessor.getOptionsManager()
def options = optionsManager.getOptions(customField.getRelevantConfig(issue))
options.each 
{    
if (options)
{
        
optionsManager.disableOption(it)    
}
}

 

Awesome! Thanks for sharing @Raynard Rhodes - I appreciate it!

-- Andrew

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,953 views 11 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you