Hi, guys.
I need to hide field values of custom field based on the value of another cf by Behaviour.
I have two Select List (single choice) fields: "Field 1P" and "Field 2W".
"Field 2W" has such values:
-Native
-Non-native
"Field 1P" has such values:
-1
-2
-3
-4
-5
I wan't that if I choose "Field 2W" = Native, i just see in "Field 1P" only "3" and "4", without other.
It's my code, but it doesn't work:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.customfields.manager.OptionsManager
List<String> optionsA = ["3","4"]
def writer = getFieldByName("Field 2W");
String writer_value = writer.getValue();
def customField = getCustomFieldManager().getCustomFieldObjectByName("Field 1P")
def cf1 = getFieldByName("Field 1P")
OptionsManager optionsManager = ComponentAccessor.getOptionsManager()
def config = customField.getRelevantConfig(getIssueContext())
def ParticipationTypeMap = [null: "None"]
def options = optionsManager.getOptions(config)
if(writer_value.toString() == "native"){
ParticipationTypeMap += options.findAll {
it.value in optionsA
}.collectEntries {
[(it.optionId.toString()): it.value]
}
cf1.setFieldOptions(ParticipationTypeMap)
}
My requirement also same , can any one help on this scenario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.