简体   繁体   English

如何使用Groovy在Jira中设置史诗链接

[英]How to set epic link in Jira using Groovy

I need to set epic link using groovy if a condition is true. 如果条件为真,则需要使用常规设置史诗链接。 I'm using the following script: 我正在使用以下脚本:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
IssueManager issueManager = ComponentAccessor.getOSGiComponentInstanceOfType(IssueManager.class)
def epiclink = CustomFieldManager.getCustomFieldObject("customfield_10101") 
issue.setCustomFieldValue(epiclink,"TS-14")

If I set the epic link to null it works, 如果我将史诗链接设置为null,那么它将起作用,

    issue.setCustomFieldValue(epiclink, null)

but setting it to an issue key doesn't work. 但是将其设置为问题密钥无效。

Any help is appreciated. 任何帮助表示赞赏。

I'm not sure why you aren't using ComponentAccessor.getIssueManager(), but that is a different question. 我不确定为什么不使用ComponentAccessor.getIssueManager(),但这是另一个问题。

Epic Link is an Issue Object, not the Key 史诗链接是一个发行对象,而不是密钥

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
IssueManager issueManager = ComponentAccessor.getOSGiComponentInstanceOfType(IssueManager.class)
def epiclink = CustomFieldManager.getCustomFieldObject("customfield_10101") 

issue.setCustomFieldValue(epiclink,IssueManager.getIssueObject("TS-14"))

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

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