Hi everybody,
I want to disable particular options of a select custom field with the groovy script runner. I´ve already tried to find a solution with optionManager.disableOption but obviously my groovy skills aren´t good enough.
Can somebody give me a code example to disable a particular option of a custom field?
Thank you in advance for your support.
Best regards
Dennis
Hello @Dennis S_
Here is example that get options for the field checks values of options and disable option with given value
import com.atlassian.jira.component.ComponentAccessor
def issue = ComponentAccessor.getIssueManager().getIssueObject("TEST-1") // get issue where field exist
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Your CustomField Name")
def optionsManager = ComponentAccessor.getOptionsManager()
def options = optionsManager.getOptions(customField.getRelevantConfig(issue))
options.each {
if (it.value == "some option value"){
optionsManager.disableOption( it)
}
}
@Mark Markov Thanks it worked, where the other script I tried on community has disabled all options by skipping the "issue key" I given. Yours has fixed it.
But how can I do bulk update for a list of 100 options in a 6000 entry MLCS/Single-select field?
Please share your ideas.
Thanks,
Srikanth Ganipisetty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This doesn't appear to workin in Behaviours, unless I'm missing something.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Call it in Script Console/Post Functions using Workflow changes/Trigger it using automation rules in "Automation for Jira".
Not the behavior - Here you can hide them, but cannot perform actions like "Disabled/Deleted/Enabled"
Thanks,
Srikanth Ganipisetty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
Can someone provide me same with for one particular issuetype instead of a particular issue?
I am looking for MyRequirement.
Thanks in advance
Satya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.