Can I archive issues to another project using Automation for JIRA?

andreas
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.
September 19, 2016

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?

1 answer

1 accepted

0 votes
Answer accepted
andreas
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.
September 19, 2016

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

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events