环境 Environment
Jira Software 8.16.1
ScriptRunner for Jira 6.24.0
描述 Description
中文
由于子任务不能与 Epic 相关联,则 Epic Name 无法显示在子任务界面上。
使用 Script Runner 使能能够在子任务界面上显示其父任务所对应的 Epic 的 Epic Name。
English
Use ScriptRunner to display the Epic Name on the sub-task screen.
脚本 Script
github.com/Shankschn/Jira-Script 中的 show_epic_name_on_sub-task_screen
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.IssueManager;
CustomField tempEpicName = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Epic Link")
IssueManager issueManager = ComponentAccessor.getIssueManager();
MutableIssue epic = issueManager.getIssueObject(
(String)issue.getParentObject().getCustomFieldValue(tempEpicName)
);
CustomField strEpicName = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10005") # customfield_10005 = Your Epic Name Field
String fh = epic.getCustomFieldValue(strEpicName)
return fh