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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,460,395
Community Members
 
Community Events
176
Community Groups

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

 

 

3 answers

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

This script worked like charm!! Thankyou!!!

@Raynard Rhodes 

Oops!!

Unfortunately, your script was updating all options in the given custom field 'we used custom field by name' rather than updating custom field + single jira ticket. 

it updated 3K+ records in a go quickly.. the script needs to be developed before we execute everything. 

 

@Mohan Sundar  Have you made any improvements to the script before we execute,, because it messed up our data? 

 

Thanks,

Srikanth Ganipisetty

@Srikanth Ganipisetty The script is to disable all the custom field values if they are enabled. 

I had changed the issue id and the Custom field name and then executed it.

Thumb rule: Try to have a test custom field with few values and test project to test any such scripts.

Like Srikanth Ganipisetty likes this

@Srikanth Ganipisetty 

I think this is a valuable lesson to test scripts in test environments before just executing random internet code.

Like Srikanth Ganipisetty likes this

I agree @Raynard Rhodes I ran on test environments, but we have 1000_ records to turn back into enabled, where my intial task is to disable only 50+ records. It's a valuable lesson. 

@Mohan Sundar I should have do that trying it on a test custom field. 

Thanks,

Srikanth Ganipisetty

Hi ,

 

I have a custom field[Single Select list] with 5 options in it. I have disabled one option with Custom Field Configuration in Jira. When i import issues with CSV with disabled Custom Field Option it is creating new issue..how to block it from creating issues with disabled options.

Suggest me some answers,

 

Thanks in Advance

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 _Sparxsys_

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.

Like Srikanth Ganipisetty likes this

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

Hey @Jaswanth P !

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

Like Srikanth Ganipisetty likes this

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

@Andrew Zimmerman @Jaswanth P 

which method works for you both? we have 100+ in a MLCS field consisting 6000 records, and the page is really slow and it takes so long to update 1 field and to wait for the refresh etc. 

Jaswanth, have it worked through SQL method? 

Thanks,

Srikanth Ganipisetty

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events