I'm new with ScriptRunner and Groovy and I try to create my first post function script. I want to move an issue from one project to another - I haven't found a working solution on google. My idea is to "simulate" this behaviour - 1.) create a clone issue per ScriptRunner 2.) copy history from old issue 3.) delete old issue 4.) set link from old issue to new issue. But I fail with the history and the link from the old issue to the new one.
Is this the right way to create the link (see link below)? Does anyone have an example how to use it?
Or shoud I realise the move-behaviour with the MoveIssueBean? Like I said, I hadn't found a working solution on google.
Thanks a lot!
I think there's a logical flaw in here - "4.) set link from old issue to new issue." - a link has an issue at both ends. But you've deleted the original issue. So you can't link to it. Even if you linked before delete, the deletion would clobber the link you've just created.
"Move" in JIRA is hard - the move functions have to check that all the data in the source issue matches the configuration for the target. This means checking all the fields, and things that aren't really fields (and are hence a lot harder - status and issue type for example), and it's often impossible to automate because there's no actual logic for a move - you have to ask the user what they really want.
That said, if the config for source and target is the same, or you can make assumptions about equivalence (e.g. field X is mandatory in the target, but your move code is allowed to assume "pick option 3 if X is blank in the source"), you can code for proper move, and yes, use MoveIssueBean. That will handle most of the work, including keeping the history. It'll also preserve all the comments too.
Your "clone and copy history" idea is another good way to do it, but you're still going to need to think about the configs, history, comments and the rest. I'm not sure it's better than trying to use the MoveIssueBean.
Over the next several weeks we'll be sharing some of our Getting Started guides here in the community. Throughout this series of posts, we'd love to hear from customers and non-customers ab...
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
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs