简体   繁体   English

在按需按需自动解决票证

[英]Auto-resolve tickets within Jira-On-Demand

在SAAS版本的Jira中,是否可以在给定时间段后自动关闭票证?

I had to do something similar , not closing issues but rather creating a 12/24/36/48 hours reminder to issues. 我必须做类似的事情 ,而不是关闭问题,而是创建一个12/24/36/48小时的问题提醒。 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: 使用Jira Scripting Suite ,我使用以下代码创建了一个后功能,并将其放置在每个进入“打开”状态的过渡上,以保持问题的开放时间:

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: 我创建了一个新的过滤器,以获取开放时间超过24小时的问题列表:

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. 最后-我使用了Jira远程API - XML-RPC方法来编写计划每5分钟运行一次的python脚本。 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. 该脚本会读取过滤器发出的所有信息,并将所有处于“打开”状态的信息拉出24小时/ 36小时/ 48小时以上,发送提醒电子邮件,并将其标记为已通知,因此将仅发送每种类型的提醒。

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. 您可以转到原始问题以查看完整的脚本,但是如果您使用的是新的Jira实例,则可能要使用此处的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 :) 如果您需要编码方面的帮助,请随时询问:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM