Hello,
I've changed email template for issue Created event by adding value from custom field named ITDR, like this:
$issue.getCustomFieldValue("ITDR")
As a result in notification email I get the same text (script code) instead of custom field value from specific issue.
Even in TemplateSet preview using existing issue it looks the same.
Of course I doublechecked that custom field exists for specific issue and it is populated.
What I am doing wrong?
JIRA version is 6.3.6
Thanks.
Community moderators have prevented the ability to post new answers.
Ah ok, so you have to do it the way [~ferenc kiss] suggested and use the customfield-Id.
This is the official document: https://developer.atlassian.com/display/JIRADEV/Adding+Custom+Fields+to+Email
$issue.getCustomFieldValue("customfield_11208")
You find the customfield-id by browsing Administration > Issues > Custom Fields (see the screenshot)customfield_id.png
Thank you Paul, it works now! The way how to find customfield_id is new to me, I am a little bit surprised it is not visible at Administration > Issues > Custom Fields without code inspector.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have to identity the custom fields with their ID's, not with their names:
$issue.getCustomFieldValue("customfield_10123")
...where 10123 is the numerical identifier of your CF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Ferenc, it works now! Honestly, somehow I was convinced that ID of CF is the same as its name, maybe because ID isn't visible at CF admin screen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can't acces the value directly with the name. First you have to access the CustomField (See the API: https://docs.atlassian.com/jira/6.3.6/com/atlassian/jira/issue/Issue.html).
Use the CustomFieldManager for accesing the CustomField.
Something like this should do what you want:
CustomField field = customFieldManager().getCustomFieldObjectByName("ITDR") // You can cast if you know the data type Object itdr = issue.getCustomFieldValue(field);
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.