Email template question - plain text

Rumceisz July 30, 2012

Hi All,

I created a new template which works great but I have a trouble with a custom field:

I have a custom field called 'Comment for Reporter' which is look like this in the plain text template:

Comment for Reporter: 
$issue.getCustomFieldValue("customfield_10000")

The Comment for Reporter string is the title of the value but the value of the field comes from the code. The problem is that if I don't fill this custom field - so I leave it blank - in the notification email the code string '$issue.getCustomFieldValue("customfield_10000")' appears. What did I miss in the template???

Can you please help?

Thanks a lot in advance!

Rumi

4 answers

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 30, 2012

Try

#if ($issue.getCustomFieldValue("customfield_10000"))
$issue.getCustomFieldValue("customfield_10000")
#end

or

#set ($temp = issue.getCustomFieldValue("customfield_10000") )
#if ($temp)
  $temp
#end

(I'm not sure which is more efficient, I don't know Velocity and Java well enough)

Dennis Kromhout van der Meer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 30, 2012

Haha, 47 sec difference, seems we both thought of the same solution :)

Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2012

The first option works best, especially whent the value concerned is not derived, as data is the computed twice.

The problem with the second option is that with no CF value, the assignment will fail and you will get velocity 'error' noise.

Rumceisz July 31, 2012

Hi Nic,

don't be modest:)

The first idea was perfect!

Thank you!

Rumi

0 votes
Dennis Kromhout van der Meer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 30, 2012

Do you have any specific error in the logs? You could maybe fix it like this:

#if ($issue.getCustomFieldValue("customfield_10000"))
    $issue.getCustomFieldValue("customfield_10000")
#end

Rumceisz July 31, 2012

thank you Dennis!

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 30, 2012

Try

#if ($issue.getCustomFieldValue("customfield_10000"))
$issue.getCustomFieldValue("customfield_10000")
#end

or

#set ($temp = issue.getCustomFieldValue("customfield_10000") )
#if ($temp)
  $temp
#end

(I'm not sure which is more efficient, I don't know Velocity and Java well enough)

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 30, 2012

Try

#if ($issue.getCustomFieldValue("customfield_10000"))
$issue.getCustomFieldValue("customfield_10000")
#end

or

#set ($temp = issue.getCustomFieldValue("customfield_10000") )
#if ($temp)
  $temp
#end

(I'm not sure which is more efficient, I don't know Velocity and Java well enough)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events