Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
jernandez Atlassian Team Dec 12, 2016

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

 

 

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

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

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

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

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!

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

84 views 0 1
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you