Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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?

1 answer

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

638 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you