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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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

0 votes
Gustavo Félix
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Sep 24, 2020

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
AUG Leaders

Atlassian Community Events