如何配置具有自动增量值的自定义字段?

How to configure a custom field with auto increment value?

我有一个循环的 jira 工作流,如果某些转换执行为 "solution failed"。我的问题是我需要计算一张票得到了多少次 "solution failed"。无论如何我可以实现这个?。而且这个计数也需要在工单中查看。

最初我创建了一个自定义字段并附加到 workflow.then 中的相关屏幕,之后我如何计算通过某个 transition.this 字段的工单应自动更新的次数。

JIRA 本身将无法执行您的计划。您必须使用插件,可能是 ScriptRunner 或 JJupin。您可以使用 ScriptRunner 的最新免费版本来避免商业许可。

这里有更多信息https://answers.atlassian.com/questions/266510/script-to-increment-value-of-custom-field-in-post-validation-condition

使用 Script Runner,您可以创建一个脚本字段,该字段将只计算相关 changeItems。这是计算问题被置于 Closed 状态的次数的示例。

import com.atlassian.jira.component.ComponentAccessor
def items = ComponentAccessor.changeHistoryManager.getAllChangeItems(issue).findAll{it.field=="status" && it.getTos().iterator().next().value=="Closed"}
items.size().toString()