【问题标题】:Velocity -- get customfield value for Jira subtaskVelocity -- 获取 Jira 子任务的自定义字段值
【发布时间】:2015-03-20 16:09:54
【问题描述】:

我正在为 Jira 构建 Velocity 脚本,但我需要一些帮助。

我在 Parent Jira 票证中有一些子任务。我想在该子任务中获取某些自定义字段的值。

这是我尝试过的:

#foreach($subTask in $issue.getSubTaskObjects())
     $cf = $getCustomFieldObject(customfield_11758) 
     $subTask.getCustomFieldValue($cf)
#end

但这似乎不起作用。我的目标是让 customfield_11758(在子任务中)在脚本中打印出它的值。

谁能帮帮我?

【问题讨论】:

    标签: jira velocity


    【解决方案1】:

    getCustomFieldObject 是 CustomFieldManager 的一个方法:https://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/CustomFieldManager.html

    我看到 $customFieldManager 可用于 JIRA 速度电子邮件模板:https://developer.atlassian.com/jiradev/jira-architecture/jira-templates-and-jsps/velocity-context-for-email-templates 但我不确定它是否被注入到非电子邮件模板中。所以试试 $customFieldManager.getCustomFieldObject(customfield_11758)。如果没有 $customFieldManager 字符串 "$customFieldManager.getCustomFieldObject(customfield_11758)" 将被打印出来。

    在这种情况下,您需要确保您的工作流操作具有 CustomFieldManager 的 getter,然后您可以像这样使用它:

    $customFieldManager.getCustomFieldObject($type)
    

    或者有一个包装 customFieldManager.getCustomFieldObject 的方法,然后你从模板中调用该方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-19
      • 2015-01-17
      • 1970-01-01
      相关资源
      最近更新 更多