my jira version is 4.4.1
my customer ask me to add Custom Fileds to Email.
in atlasssian-jira\WEB-INF\classes\templates\email\text\issueupdated.vm ,i add below code .
#foreach ($value in $customFieldManager.getCustomFieldObjects($issue)) #if ($value.getValue($issue) && !($value.getName()=="Comments") && !($value.getName()=="TimeSpent_Resolve") && !($value.getName()=="TimeSpent_StartProgress")) >>$stringUtils.leftPad($value.getName(), $padSize): $!value.getValue($issue) #end #end
email can display most fields normally.but the Cascading Select Field seems not.
it display as
CSField:CustomFieldParams:CSField. Params:{null=[LCD],1=[WWG]}.
i resolved it.
#foreach ($value in $customFieldManager.getCustomFieldObjects($issue)) #if ($value.getValue($issue) && !($value.getName()=="Comments") && !($value.getName()=="TimeSpent_Resolve") && !($value.getName()=="TimeSpent_StartProgress")) #if($!value.getCustomFieldType().getName()=="Cascading Select") >>$stringUtils.leftPad($value.getName(), $padSize): $!value.getValue($issue).getFirstValueForNullKey()/$!value.getValue($issue).getFirstValueForKey("1") #else >>$stringUtils.leftPad($value.getName(), $padSize): $!value.getValue($issue) #end #end #end
This works to get the two values from the cascading select.
First value:
<% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("My Cascading Select Custom Field Name")).get(null) %>
<% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("My Cascading Select Custom Field Name")).get("1") %>
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.
Hello,
My JIRA vesrion is v4.4.3
I am trying to display cascading select custom field (named 'Servicios') values in a custom email, using post functions on the workflow.
- This is the template code:
Servicios afectados: <% if (cfValues['Servicios']) out << cfValues['Servicios'] %>
- Values are displaying like this:
Servicios afectados: CustomFieldParams: Servicios. Params: {null=[OSS], 1=[OVO]}
How can I display only values (i.e OSS,VIVO? What I want is to remove the remaining words on the line above and show only the values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
The answer from https://answers.atlassian.com/questions/54609/cascading-select-custom-field-in-jira-5-email-templatesapplies here too:
<tt>getCustomFieldValue</tt> is a method on the <tt>Issue</tt> object, specified in the api at https://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/Issue.html
Accordingly, the return value is defined as:
A custom field's value. Will be a List, User, Timestamp etc, depending on custom field type.
Knowing this, by invoking:
$issue.getCustomFieldValue("customfield_11406")
You are getting a <tt>Map<String, Option></tt> where <tt>null</tt> is the key for the parent option and <tt>1</tt> is the key for the child option.
In order to get these values individually it's only necessary to iterate over the Map, for instance:
#foreach( $optionKey in $issue.getCustomFieldValue("customfield_11406").keySet() ) <li>Key: $optionKey -> Value: $issue.getCustomFieldValue("customfield_11406").get($optionKey)</li> #end
The above should work for JIRA 6.2.x
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I have the same problem:
CustomFieldParams: Servicios. Params: {null=[CDN SERVICE], 1=[Ingest]}.
I am trying to display a cascading select field in email notifications, but using post functions.
Which code it should be used in this case?
Thanks a lot in advanced.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.