
[英]How to create an internal comment on a jira issue using the JIRA Cloud REST API
[英]How to update the comment of an issue in Jira
我正在尝试将一些文本连接到用户输入的评论。 我怎样才能做到这一点? 下面是我的代码。 我需要访问用户输入的评论,然后向其中添加新文本。 我怎样才能访问这个? 我正在使用 Jira ScriptRunner 自定义后功能,以在用户单击转换时执行。
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.workflow.JiraWorkflow
import com.atlassian.jira.workflow.WorkflowManager
import org.apache.log4j.Logger
import com.atlassian.jira.component.ComponentAccessor
def log = Logger.getLogger("atlassian-jira.log")
log.warn("This is the last action ")
WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager();
JiraWorkflow workflow = workflowManager.getWorkflow(issue);
List <Object> actions = workflow.getLinkedStep(issue.getStatus()).getActions();
def wfd = workflow.getDescriptor()
def actionName = wfd.getAction(transientVars["actionId"] as int).getName();
log.warn("This is the last action "+actionName)
def comment= "+++ added via workflow action "+"\""+actionName+"\"+++"
这是代码transientVars是go的方式。
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.workflow.JiraWorkflow
import com.atlassian.jira.workflow.WorkflowManager
import org.apache.log4j.Logger
import com.atlassian.jira.component.ComponentAccessor
def log = Logger.getLogger("atlassian-jira.log")
log.warn("This is the last action ")
WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager();
JiraWorkflow workflow = workflowManager.getWorkflow(issue);
def wfd = workflow.getDescriptor()
def actionName = wfd.getAction(transientVars["actionId"] as int).getName();
log.warn("This is the last action "+actionName)
def comment= "+++ added via workflow action "+"\""+actionName+"\"+++"
String content = transientVars["comment"] +"\n"+comment as String
log.warn("CONTENT"+ content)
transientVars["comment"]= content
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.