Velocity template broke after upgrading to JIRA 6.0.2

We recently upgraded from JIRA 5.2 to 6.0.2, and our custom release notes template apparently broke. Most of it works ok, but we have one custom field (called "Config Notes") that now isn't displaying correctly. Previously, it would display as nicely formatted and indented text. However, now it looks like all the HTML formatting tags and special characters (tabs, etc.) are being displayed along with the text. For example, if this is the content of the field:

###OPTIONAL###
ctc.cfg
=====
/Machine/materialManager/materialNamingPolicy
      #RenameMaterialBaseOnJobID -> true

Then this is what the output looks like on the screen:

###OPTIONAL### <br/> ctc.cfg <br/> ===== <br/> /Machine/materialManager/materialNamingPolicy <br/>       #RenameMaterialBaseOnJobID -> true

The formatting is important - I'd really like to get it to display in the release notes properly again. The macro we use to generate the config notes is here:

#macro (getConfigNote $issue $customFieldManager)
    #set ($customFields = $customFieldManager.getCustomFieldObjects($issue.project.getLong("id"), $issue.issueType.getString("id")))
    #foreach($customField in $customFields)
        #if($customField.name.equals("Config Changes"))
            #if($customField.getValue($issue))
                 $textUtils.indent($textUtils.br($textUtils.leadingSpaces($customField.getValue($issue))) ,2,false)
            #end
        #end
    #end
#end

Any help in tracking down what broke and how to fix it would be greatly appreciated.

Thanks,

Jason

2 answers

1 accepted

0 votes

Look at the velocity escaping changes in JIRA5: https://developer.atlassian.com/display/JIRADEV/Velocity+Templates

You have a couple of options for solving the problem. You could add

#disable_html_escaping()

...to the top of your template file; or you could set the custom field's value to a variable that has 'html' at the end of its name:

#set($contentAsHtml = $customField.getValue($issue))
$contentAsHtml

... and there are a couple more options if you were to obtain the value via a custom method call, but I'm guessing that's not what you're after.

You'll have this one solved in no time.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,039 views 13 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot