Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Test a value in CustomField

Eduardo Mello
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 11, 2020

Hello, I'm trying to test a value on an object so that if it doesn't exist, I print another field. however I am having trouble making the test condition when the CustomField has no value. Can someone help me?

this line: #if($issue.getCustomFieldValue($customField.id).size() < 10)


<!-- "Fixes and Enhancements" section -->
#set($hasFixOrEnhancement = false)
#foreach($issue in $issues)
#if($issue.resolutionObject && $issue.issueTypeObject.name != "New Feature")
#if($hasFixOrEnhancement == false)
#set($section = $section + 1)
<fo:block font-size="200%" space-before="1cm" font-weight="bold">${section} Correções e melhorias</fo:block>
<fo:list-block border-top="think solid black" space-before="2mm" padding-top="2mm" start-indent="inherited-property-value(start-indent) + 5mm" provisional-distance-between-starts="$labelSize">
#set($hasFixOrEnhancement = true)
#end
<fo:list-item space-after="0.5em">
<fo:list-item-label font-weight="bold" end-indent="label-end()">

#set($customFields = $customFieldManager.getCustomFieldObjects($issue))
#foreach($customField in $customFields)
#set($customFieldValue = $issue.getCustomFieldValue($customField.id).toString().trim())
#if ($customField.getName() == "Movidesk")
#if($issue.getCustomFieldValue($customField.id).size() < 10)

<fo:block>$xmlutils.escape($issue.getCustomFieldValue($customField.id))</fo:block>
#set ($Default = "Movidesk")
<fo:block>$xmlutils.escape($Default)</fo:block>
#else
#set ($Default = $issue.key)
<fo:block>$xmlutils.escape($Default)</fo:block>
#end
#end
#end
</fo:list-item-label>

<fo:list-item-body start-indent="body-start()">
<fo:block>$xmlutils.escape($issue.summary)</fo:block>
</fo:list-item-body>
</fo:list-item>
#end
#end
#if($hasFixOrEnhancement == true)
</fo:list-block>
#end

1 answer

0 votes
John Funk
Community Champion
November 11, 2020

Hi Eduardo - Welcome to the Atlassian Community!

Can you describe the exact values and process you want to see? I am thinking it might be easier to use something like Automation For Jira. 

Eduardo Mello
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 11, 2020

Hi Jonh, I'm using a Better PDF Exporter template. I am trying to test whether a customizable item field is populated. If not, I will display another value.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events