I would like to copy old issues to an 'archive' project once they've been closed for a while and delete them in the current project. Can I do this with Automation for JIRA?
Yes, you can do this with a "Scheduled JQL trigger" and "Clone issue action".
Here's what your rule setup would look like:
Project automation - Code Barrel JIRA 2016-09-20 10-16-14.png
So we have a JQL Scheduled trigger that looks for "Done" issues older than 10 weeks, that we run every 7 days. These issues are then cloned to our "Archive" project.
Now unfortunately JIRA's APIs make it a bit difficult to preserve things like the comment history (because we can't add comments to the cloned issue as other users and using different dates, but fortunately we can cheat a bit here using the power of smart-values:
Project automation - Code Barrel JIRA 2016-09-20 10-17-56.png
The important bit is the Advanced section:
{ "fields": { "description": "{{{issue.fields.description}}}\n\n*Comments*\n{{#issue.comments}}By [~{{{author.key}}}] - {{created}}\n{quote}{{{body}}}{quote}\n\n{{/issue.comments}}" } }
This simply iterates through all the comments of the original issue and adds them to the description of the cloned issue like this:
[AR-9] This needs log files! - Code Barrel JIRA 2016-09-20 10-19-30.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.