I need to copy the value from one custom field to another; the source field is a select list (single choice) and the target field is a select list (cascading). I've found nothing that says this isn't possible. The change would be extensive, and affect 6,000+ issues. Every time I try the script, I get an incomprehensible java error.
java.lang.ClassCastException: com.atlassian.jira.issue.customfields.option.LazyLoadedOption cannot be cast to java.util.Map
There is an extensive stack trace message, which is equally incomprehensible and pointless to post here.
This doesn't even tell me in plain language whether this worked even partially, and I have no idea how to go about fixing it.
It's the nature of the storage. The value held in a single select is a single "option". The value held in a cascading-select is a pair of options held in a "map" object.
You can only use the standard script to copy values between compatible fields that store the same options. You can take most of the copy script as it is, but before trying to store the cascading value, you'll need to create a valid map to store it with. Bear in mind you'll also need to work out what BOTH parts of the cascading select are. (Even if you have say "kitty" as both source and target values, a cascading select needs the parent value too, like "animal -> kitty")
I have https://answers.atlassian.com/questions/234417 buried in my bookmarks to remind me how to write to cascading selects.
(I like the comment about "equally incomprehensible" - java stack traces are only useful to developers who have the actual code. 99.99% of the time, we only need the first couple of lines!)
I appreciate the speed of your response. I hope you don't mind the bit about the stack trace message- it's just not a useful user confirmation/warning message.
But parsing the conversation, not being a Groovy coder, is a little more difficult than anticipated. I'm having a little trouble isolating which is the correct script to use as a model to modify. Whose script (which one) should I look at?
In the link I gave, I'd use Robert Mota's third snippet on his answer starting with "using componentaccessor now" as the starting point - that showed me how to create the "map" that needs to be built for the cascading select, and how to push it into the field You do need to think about your translation too. You have a single select field option, but the target has two possible places for it. If you want to place it in the parent option, that's fine, just set the child to null in the map, and you'll end up with a cascading select with no child selected. If you want it in the child option, you need to work out which parent option the value belongs to and populate that in the map as well
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG