0

SAASバージョンのJira内で、一定期間後にチケットを自動的に閉じる方法はありますか?

4

1 に答える 1

0

I had to do something similar, not closing issues but rather creating a 12/24/36/48 hours reminder to issues. I did this by creating a custom field called "Open since" - a 'Date Time' field to hold the time the issue has been opened.

Using the Jira Scripting Suite, I've created a post-function and placed it on every transition going to the 'Open' status in order to keep the issue opening time, using the following code:

from com.atlassian.jira import ComponentManager
from datetime import datetime
opend_since_field = "customfield_10001"
# get opened since custom field:
cfm = ComponentManager.getInstance().getCustomFieldManager()
# get current time
currentTime = datetime.today()
# save current time
issue.setCustomFieldValue(cfm.getCustomFieldObject(opend_since_field),currentTime)

I've created a new filter to get the list of issues that are open for over 24h:

project = XXX AND status= Open ORDER BY updated ASC, key DESC

Lastly - I've used the Jira remote API - the XML-RPC method to write a python script scheduled to run every 5 minutes. The script reads all the issued from the filter, pulls all of them that have an 'Open' status for over 24h/36h/48h, send a reminder email, and mark them as notified, so only one reminder of each type will be sent.

you can go to the original question to view the full script, but if you are working on a newer Jira instance you might want to write it using here REST API. Note that my script just send notification email, but can easily be changed to closing issues, and you can even use it to mail the closed issues to yourself.

If you need help with coding feel free to ask :)

于 2013-01-16T10:52:02.760 に答える