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
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)
Haha, 47 sec difference, seems we both thought of the same solution :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.