Email this Issue - Custom field doesn't render in Subject of email

Sandra Axelsdóttir [Tempo] September 5, 2013

I m using a custom field in a Subject of a Email This Issue Template and it doesn't work. The velocity markup is $!jetiFieldRenderer.renderCustomField($issue, 'customfield_11001'

I tried to use the same velocity markup in the body of the template and that works fine. Is this a known error or how can I fix this?

4 answers

1 accepted

0 votes
Answer accepted
Tibor Hegyi _META-INF_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 9, 2013

Sandra, #TJ(...) means a so called Velocity Macro and a declaration is required. If you use #TJ() only to mark the field value, please omit the use of #.

E.g.

$!issue.summary - verkbeiðni $!mailSubject - TJ($!jetiFieldRenderer.renderCustomField($issue, 'customfield_11001'))

Tibor

Sandra Axelsdóttir [Tempo] September 10, 2013

Thank you Tibor :)

0 votes
Tibor Hegyi _META-INF_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 8, 2013

Hi Sandra,

I suppose the #TJ() macro that you defined in the mail body template is not defined in the subject template. Therefore the custom field value is not rendered. Please try simply $!jetiFieldRenderer.renderCustomField($issue, 'customfield_11001') without the #TJ() or add the macro declaration to the subject as well.

Tibor

Sandra Axelsdóttir [Tempo] September 8, 2013

Thanks,

I tried this and it works if I take out the ( ).

But the thing is I need to have the parentheses to mark the value in the custom field. It used to work, but when I changed a different part of the subject, this stopped working. Is there a way to fix this without taking the parentheses out?

0 votes
Sandra Axelsdóttir [Tempo] September 8, 2013

Hi,

This is the whole subject:

$!issue.summary - verkbeiðni $!mailSubject - #TJ($!jetiFieldRenderer.renderCustomField($issue, 'customfield_11001'))

I checked the field and it's not empty and It's a text custom field. The email is triggered via post function.

0 votes
Tibor Hegyi _META-INF_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 7, 2013

Hi Sandra,

I have just retested the featurre and could succassfully render a custom field value in the subject.

The template fragment you quoted above lacks the closing parenthesis. Can you please check if you correctly added the custom field render template code to the subject field of the template?

Also, isn't it possible that the field was empty in the issue?

Is it a text custom field? Or something that returns a more complex object?

Do you send the email from the issue screen manually, or have you set up event notifications or post-function?

Tibor

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events