Add custom field value to filtersubscription.vm

Hi all,

I used to add custom field values in notification email so that users can see the values without login to jira. (Changing issuecreated.vm / issueupdated.vm)

Want to do this for filter subscription as well, however the same method failed to apply to filtersubscription.vm

Any ways I can do this?

Pls find the code below:

#if ($issue.getCustomFieldValue("customfield_11318"))
$stringUtils.leftPad("Market", $padSize): $issue.getCustomFieldValue("customfield_11318")
#end

6 answers

1 vote

I accessed the custom field value in this template by doing the following (assuming my custom field value is named 'Cost Center' and it's id is 10301):

#set ($cf = $customFieldManager.getCustomFieldObject('customfield_10301'))
#set ($cfValue = $cf.getValue($issue))
cost center: $cfValue

 

 

Have a look of another way of sending notifications from JIRA and use whatever custom fields you want with our plugin JJUPIN: http://confluence.kepler-rominfo.com/display/JJUP14/Email+Templates

Plugin page on PAC: https://plugins.atlassian.com/plugin/details/43318

You may evaluate it and fine probably some more interesting features.

Good luck!

That's because there is likely no $issue object in the top-level Velocity context. A filter subscription will contain a set of issues so this should work inside the loop

#foreach ($issue in $issues)
${StringUtils.rightPad($issue.getKey(), 12)}${issue.getSummary()}
${StringUtils.rightPad("", 12)}${baseurl}/browse/${issue.getKey()}
#end

I have tried to modify inside the for-loop. It works for the attribute above but not CUSTOM FIELD

Odd. The code I used for this with 4.4 is

#set ($cf = $customFieldManager.getCustomFieldObject('customfield_10380'))
#if ($cf)
  #set ($projectObject = $issue.getProjectObject())
  #set ($issueTypeObject = $issue.getIssueTypeObject())
  #set ( $idArray = [$issueTypeObject.id] )

  #if ( $cf.isInScope($projectObject, $idArray) )
    #set ($currValue = $cf.getValue($issue))
    Checking that $cf.name has a value of $currValue
  #end
#end

Tried your code by no luck.
can you show me the whole source for filtersubscription.vm?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published an hour ago in Agile

How Scrum works? It starts with training and education

To answer “How scrum works,” most of the teams I've worked with first addressed the question: “where to start?”  That question applies to both implementation and improvements on the Scrum framew...

20 views 0 0
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you