You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.
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 https://docs.atlassian.com/software/jira/docs/api/8.13.13/ - use frames and the left-bar to find OptionsManager docs