When i am trying to update cascade field "Category" using your example i get errors adn it doesnt work
def optionsManager = ComponentAccessor.getOptionsManager() def c
ustomFieldManager = ComponentAccessor.getCustomFieldManager() def fieldName = "Category" def field = getFieldByName(fieldName) def customField = customFieldManager.getCustomFieldObjectByName(fieldName) def fieldConfig = customField.getRelevantConfig(getIssueContext()) def options = optionsManager.getOptions(fieldConfig) def parentOption = options.find {it.value == "A"} def childOption = parentOption?.childOptions?.find {it.value == "A1"} field.setFormValue([parentOption.optionId, childOption.optionId])
Hi hreich.
Could you kindly state what is the error or errors that you are getting/
Cheers
Dyelamos
I am missing importers but aince i am noob i dont know which ones
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are only missing one:
import com.atlassian.jira.component.ComponentAccessor
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def fieldName = "Category"
def field = getFieldByName(fieldName)
def customField = customFieldManager.getCustomFieldObjectByName(fieldName)
def fieldConfig = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(fieldConfig)
def parentOption = options.find {it.value == "A"}
def childOption = parentOption?.childOptions?.find {it.value == "A1"}
field.setFormValue([parentOption.optionId, childOption.optionId])
This should work.
Cheers!
Dyelamos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.