Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to programatically move issue to another project ?

Julien November 9, 2018

Hello,

 

I know it exists topics saying no, but I really need to do this. I know it's one of the most complex operation in jira. However could someone give me clue to do this and not only a negative answer ?

 

Than you.

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 9, 2018

Ok, here's the positive version:

Your code will need to check that the new project and issue type configuration matches the current issue for

  • Workflow status
  • Every field's 
    • Mandatory/optional
    • Visibility
    • Context
  • Security level

(I'm pretty sure this is not an exhaustive list)

In the cases of mismatches, you'll need to think through the consequences.  For example, if a field on a source issue does not exist in the target, you should ask the user if they really do want to destroy it.  If there is not a shared status, then what status do they want to move it to? 

Your code will need to make assumptions for your users (this is bad - you will almost certainly have a user asking why you have destroyed their data), or, better, ask them what they want to do in each case.

Once you've got answers, you can feed it all into the move issue api calls you will need to make.

Julien November 9, 2018

Hi Nic

Thank you for this detailed answer. Should I use a normal http request to "/rest/api/2/issue/" with PUT ? Or with POST (only at Ticket creation ?)

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 9, 2018

Ah, neither.  This is where there is no "positive" answer.  There is no REST API to move an issue.  So there's nothing you can do here directly.

What I was talking about was the Java API internal to Jira, that you can call in scripts and Apps.  

The best you can do with REST is get a copy of the issue to be moved, then write code that creates a new one in the new project (adjusting for changes as above), and replay the comments into the new one.  Then shut-down (or delete, although I would not recommend that ever).  You'll lose data on the new one doing it this way.

Julien November 9, 2018

Ok here I'm stuck. I already have a script (java) to create a "clone" (it's not a perfect clone but works for what I have to do) in an other project, it works. I also have a script to link new issue to old one, it works. My problem : each user can create an issue with linkswhen he works in his project than move the issue. But if a user move an issue, then he can't edit it anymore, well he can't add link. 

 

Ok while writting this I got an idea, use my script to create a "clone" in an other project then link it but from the original. I'll try it, thank you !

Julien November 9, 2018

It works, well thank you Nick you helped me with my problem. I close the question.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events