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.
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.