首页 > 解决方案 > 有没有办法使用 JSON 在 Jira 中添加内部评论?

问题描述

我正在处理我公司的 Jira Service Desk 项目,我们在一些工作流自动化方面遇到了一些问题。目前要通过工作流从步骤 1(等待支持)-> 步骤 2(进行中)移动问题,用户需要在单击“进行中”按钮后输入评论才能成功将问题移动到下一步。

这按预期工作,但我们也想利用自动化规则,如果向问题添加评论,它将自动将问题从步骤 1 转换到步骤 2。出现此问题的原因是工作流验证器要求在转换期间添加注释以使问题移至下一个状态。

好消息是我们的自动化插件(Jira 自动化)允许您将 JSON 配置添加到规则中的步骤。例如,我可以添加 JSON 以在转换期间向规则添加注释,这正是我们想要的。但这里的问题是评论是发送给客户的外部评论。我们需要将此评论作为内部评论,以便在我们已经有用户联系客户时不会向客户发送任何不必要的信息。

我们试图实现的是在“等待支持”状态下出现问题,然后当内部用户对该问题发表评论时,它会使用自动化规则自动转换到下一个状态(进行中)。但是由于我们的工作流程要求,我们还需要在过渡期间添加额外的内部注释,以使过渡有效。我们的工作流程要求我们在从一种状态转换到另一种状态期间添加注释,然后才能更改状态。

到目前为止,我已经用 JSON 代码尝试了一些不同的东西,但我对 JSON 一点也不熟悉,也无法弄清楚如何区分公共/外部注释和私有/内部注释。我已经把它放到了过渡期间添加评论的位置,然后自动化成功运行,但问题是当我们需要它是内部的并且只有我们的服务台用户可见时,这个评论变成了外部评论。

   {
        "update": {

        "comment": [
    {
        "add": {
        "body": "Issue issue.key has been transitioned to the In Progress 
        status per automation guidelines."

    }

    }
    ]
    }
    }



This is the JSON code that is added at the status transition step that works. Just not 100% the right way. I am trying to somehow figure out a way to have the comment that is added be internal as opposed to external.

我能够使用“评论问题”操作并模仿我的规则以及带有“评论问题”操作的额外内部评论。导出 JSON 后,这是我得到的:

我能够使用“评论问题”操作创建我的规则并将其保留为内部评论。之后,我导出了 JSON 以查看它的外观,这就是我得到的:

    "cloud":true,
"rules":[
{
"id":188601,
"clientKey":"jira:12205936",
"name":"Incident Comment Transition ",
"state":"ENABLED",
"description":null,
"canOtherRuleTrigger":false,
"notifyOnError":"FIRSTERROR",
"authorAccountId":"5a328efd101d3439bb11039c",
"actorAccountId":"557058:f58131cb-b67d-43c7-b30d-6b58d40bd077",
"created":1559219471531,
"updated":1559221244585,
"trigger":{
"id":"3628751",
"component":"TRIGGER",
"parentId":null,
"conditionParentId":null,
"schemaVersion":1,
"type":"jira.issue.event.trigger:commented",
"value":{
"synchronous":false,
"eventKey":"jira:issue_updated",
"issueEvent":"issue_commented"
},
"children":[
],
"conditions":[
]
},
"components":[
{
"id":"3628752",
"component":"CONDITION",
"parentId":null,
"conditionParentId":null,
"schemaVersion":1,
"type":"jira.jql.condition",
"value":"assignee != empty and resolution = unresolved and status = \"waiting for support\" and issuetype=\"incident\"",
"children":[
],
"conditions":[
]
},
{
"id":"3628753",
"component":"ACTION",
"parentId":null,
"conditionParentId":null,
"schemaVersion":6,
"type":"jira.issue.transition",
"value":{
"operations":[
],
"advancedFields":"",
"sendNotifications":true,
"useLegacyRendering":false,
"transitionMode":"status",
"destinationStatus":{
"type":"ID",
"value":"3"
},
"transitionMatch":"",
"transition":null,
"ignoreConditions":false
},
"children":[
],
"conditions":[
]
},
{
"id":"3628754",
"component":"ACTION",
"parentId":null,
"conditionParentId":null,
"schemaVersion":1,
"type":"jira.issue.comment",
"value":{
"comment":"Issue {{issue.key}} has been moved to the In Progress status per automation guidelines.",
"publicComment":false,
"commentVisibility":null,
"sendNotifications":true,
"addCommentOnce":true,
"useLegacyRendering":false
},
"children":[
],
"conditions":[
]
}
],
"projects":[
{
"projectId":"10610",
"projectTypeKey":"service_desk"
}
],
"labels":[
]
}
    ]

你能告诉我这部分是添加内部评论的部分吗?我在想,如果我可以在规则的“过渡问题”步骤中使用该 JSON,这可能会完成我想要做的事情。

谢谢!

标签: jsonautomationjira

解决方案


我不知道如何用 JSON 来做,但你应该可以在他们的 GUI 中做。

在该Comment on issue操作中,More options -> Service Desk您应该会看到一个复选框Share with customer

参考:规则游乐场

您可以创建一个虚拟规则并导出规则以获取 JSON。

PS:他们的支持应该也很好。


推荐阅读