Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Add to customfield (single select drop down) from customfield (single line text field) scriptrunner

I've been trying to wrap my head around this.  We have a custom single line text field that our users enter data into.  This data would like to be used in a statistical view.  My understanding is the only way to do this is to have this custom field add each value as a option in a drop down custom field.  How would one go about automating this? I've read thru the groovy documentation and just can't seem to figure this one out,  does someone have a script they could share to do this? 

customfield_710 text add entered value as option to customfield_810 drop down

Thanks in advance.

1 answer

0 votes

Yes, that's right, to do stats, you need fields that can be indexed from a list of options.

I've done what I think you want a couple of times in the past - specifically setting up a Jira project that was for admins to track all the work, and change, on their Atlassian applications, and we did obvious stuff like "request project from template, authorise, automatically create", but also "this field's list of options is maintained by people updating a Jira issue" - stuff like "add new option please, fill in a text field with new name, click ok, and a post-function adds the option"

There's two things you'll need to look at if you do it that way. 

First, there's the actual option - the starting point there is the OptionsManager class - it's the main thing that handles options, and has calls like createOption, getAllOptions and so-on.  

Second, you'll need to consider permissions.  In my example, it was not Administrators running the post-function, so my script needed to take on the role of an admin while it was trying to call the createOption function.

I've not seen any recent examples (my code was for Jira 3, and long since forgotten which old disk I might have kept a copy on), but the Java API is over at - use frames and the left-bar to find OptionsManager docs

Thanks was hoping someone had an example we could work with rather than reinventing the wheel.  Thank you.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

227 views 1 2
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