Greetings Mates,
Can anyone help me to write a code to update options in a " Single Select" customer filed value ? I am absolutely new to Jira and scripting on it. I just could succeed to use my groovy now for running simple scripts as post functions.
Now I have a Single Select custom filed. It is a general custom filed being used by many issues.
I need to add some options on it and update the options sometimes.
I could find below question very similar to mine , but in the answer it is clear that options for an specific issue or issues will be updated by running the script.
In my case , I am going to update a custom field independent to the issues.
This is my code. I can call the custom filed by its ID (thanks to sample scripts).
Now I need to update its options ...
It would be appreciated to have your advices and supports.....
import com.atlassian.jira.issue.IssueManagerimport com.atlassian.jira.issue.CustomFieldManagerimport com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.event.type.EventDispatchOptionimport com.atlassian.jira.issue.fields.config.manager.FieldConfigManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()def optionsManager = ComponentAccessor.getOptionsManager()def myCustomField1 = customFieldManager.getCustomFieldObject("customfield_10221")
?
Link of the similar question
https://community.atlassian.com/t5/Jira-questions/script-of-add-values-to-single-select-list-custom-field/qaq-p/872349?tempId=eyJvaWRjX2NvbnNlbnRfbGFuZ3VhZ2VfdmVyc2lvbiI6IjIuMCIsIm9pZGNfY29uc2VudF9ncmFudGVkX2F0IjoxNjQ1ODkzMDkwNjU4fQ%3D%3D
Another one that I could find when writing this question
but without answer...
https://community.atlassian.com/t5/Jira-questions/Bulk-importing-adding-options-to-a-select-list-custom-field/qaq-p/181084
Hi @Omid Zolfaghari
Welcome to the community and thank you for creating your first question ..
When looking at your problem I am wondering if you really need a script.. Definitively adding an option to Select List should be easy to do via UI..
And then.. Updating a value probably means that you have some conditions.. If condition is met you would update the field and choose this new value.. Is that correct?
Maybe we can simply use a standard Bulk Change.. Everything depends on the scale. You were saying "many issues" so I am wondering how many there are actually..
Could you please clarify a little bit more on effort that is required?
It looks like you're new here. Sign in or register to get started.