Hi!
Is there any possibility to change parent option or parentOptionId of allready existing com.atlassian.jira.issue.customfields.option.Option?
When creating it's possible to set by
optionsManager.createOption(FieldConfig fieldConfig, Long parentOptionId, Long sequence, String value)
but if option allready exists?
Hi @Колыбаев Игорь Михайлович
If I understood you correctly, you want to change an option inside a select Field ?
If this is correct, this works for me inside a workflow transition:
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.context.IssueContextImpl
def selectCustomField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("yourSelectField")
def selectField = issue.getCustomFieldValue(selectCustomField)
IssueContextImpl issueContext = new IssueContextImpl(issue.getProjectObject(), issue.getIssueType())
def selectConfig = selectCustomField.getRelevantConfig(issueContext)
def selectOptions = ComponentAccessor.optionsManager.getOptions(selectConfig)
for(select in selectOptions){
if(select.toString().contains("option1")){
selectOptions.setValue(select,"newOption1")
}
}
This is another example on a behaviour.
https://library.adaptavist.com/entity/set-behaviour-multi-and-single-select-options-and-value
Options have a parameter Long parentOptionId, used in cascading select fields, which can be setted during creation of an Option. My question is how parent Option can be modified for an allready existing Option. I meen changing parent Option to some another.
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.