Jira 速度,检查自定义字段是否具有特定值

Jira 速度,检查自定义字段是否具有特定值,jira,velocity,Jira,Velocity,我正在使用插件“Email this issue”定制电子邮件通知。我需要添加一些自定义字段,带有标签。如果字段(字符串)为空,我想省略标签 这是我的主题: $!issue.summary#if($!mailSubject) $!mailSubject#end EU:#renderCustomField($issue, 'customfield_12752') RES:#renderCustomField($issue, 'customfield_11734') DIS:#renderCusto

我正在使用插件“Email this issue”定制电子邮件通知。我需要添加一些自定义字段,带有标签。如果字段(字符串)为空,我想省略标签

这是我的主题:

$!issue.summary#if($!mailSubject) $!mailSubject#end EU:#renderCustomField($issue, 'customfield_12752') RES:#renderCustomField($issue, 'customfield_11734') DIS:#renderCustomField($issue, 'customfield_11735')
如果自定义字段为空字符串或null,则应忽略相应的标签

示例:自定义字段1275和11735为空

这就是我的主题的结果:

summary mailsubject EU: RES: xyz DIS:
这就是主题的结果:

summary mailsubject RES: xyz

根据输入,您必须检查的是,如果标签为空,则不应打印标签。为了避免这种情况,您必须在标签周围加上if条件

#if($!val){
Your value:val
}
要检查您的更改,您必须遵循jira的建议,遵循URL和。本网站还提供了一个链接建议

因此,您的代码必须按照这种方式工作

$!issue.summary
            #if($!mailSubject)
                $!mailSubject
             #end
          // You can set the value to a variable and check the null condition      
            #set($eu = $!jetiFieldRenderer.renderCustomField($issue, 'customfield_12752')))
              //In in this cass if null it will go to inside
                #if($!eu)
                    EU:#renderCustomField($issue, 'customfield_12752')
                #end
               #set($res= $!jetiFieldRenderer.renderCustomField($issue, 'customfield_11734'))
                #if($res)
                    RES:#renderCustomField($issue, 'customfield_11734')
                #end
            #set($dis=$!jetiFieldRenderer.renderCustomField($issue, 'customfield_11735'))
               #if($dis)
               #end
            DIS:#renderCustomField($issue, 'customfield_11735')
         #end

根据输入,您必须检查的是,如果标签为空,则不应打印标签。为了避免这种情况,您必须在标签周围加上if条件

#if($!val){
Your value:val
}
要检查您的更改,您必须遵循jira的建议,遵循URL和。本网站还提供了一个链接建议

因此,您的代码必须按照这种方式工作

$!issue.summary
            #if($!mailSubject)
                $!mailSubject
             #end
          // You can set the value to a variable and check the null condition      
            #set($eu = $!jetiFieldRenderer.renderCustomField($issue, 'customfield_12752')))
              //In in this cass if null it will go to inside
                #if($!eu)
                    EU:#renderCustomField($issue, 'customfield_12752')
                #end
               #set($res= $!jetiFieldRenderer.renderCustomField($issue, 'customfield_11734'))
                #if($res)
                    RES:#renderCustomField($issue, 'customfield_11734')
                #end
            #set($dis=$!jetiFieldRenderer.renderCustomField($issue, 'customfield_11735'))
               #if($dis)
               #end
            DIS:#renderCustomField($issue, 'customfield_11735')
         #end
这对我有用

    #set ($ln = $customFieldManager.getCustomFieldObjectByName('CustomTextField'))
    #if($issue.getCustomFieldValue($ln))
    $issue.getCustomFieldValue($ln)
    #end
希望这对我有帮助

    #set ($ln = $customFieldManager.getCustomFieldObjectByName('CustomTextField'))
    #if($issue.getCustomFieldValue($ln))
    $issue.getCustomFieldValue($ln)
    #end

希望有帮助

你能再解释一下吗?
#如果($!somevalue)
足够空的话。@soorapadman我已经编辑了这个问题。#if($!somevalue)是否仅对jira字段有效?自定义字段的sintax是什么?你能再解释一下吗?
#如果($!somevalue)
足够检查空的话。@soolapadman我已经编辑了这个问题。#if($!somevalue)是否仅对jira字段有效?自定义字段的sintax是什么?