Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

What is in the velocity context for JIRA?

Andrew
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 25, 2015
 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Andrew
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 25, 2015

If you are unsure what parameters and Object's are in the Velocity context, the links below may help:

For developers, who want to know more, the DefaultVelocityManager creates a self-reference back to the VelocityContext with these lines:

protected VelocityContext createVelocityContext(Map params)
    {
        if (params != null)
        {
            params.put("ctx", params);
        }
    ...

Therefore, doing this in the template will display the available parameters:

#foreach($p in $ctx.keySet().toArray())
  $p.toString() - $ctx.get($p).getClass().getName().toString()
#end

e.g.

textutils - com.opensymphony.util.TextUtils
  dateformatter - com.atlassian.jira.web.util.OutlookDate
  stringUtils - org.apache.commons.lang.StringUtils
  formatter - java.text.SimpleDateFormat
  constantsManager - com.atlassian.jira.config.DefaultConstantsManager
  buildutils - com.atlassian.jira.util.BuildUtils
  i - java.lang.Integer
  context - com.atlassian.jira.mail.TemplateContext
  jiraUserUtils - com.atlassian.jira.util.JiraUserUtils
  baseurl - java.lang.String
  security - $ctx.get($p).getClass().getName().toString()
  numdashes - java.lang.Integer
  ctx - java.util.HashMap
  jirakeyutils - com.atlassian.jira.util.JiraKeyUtils
  i18n - com.atlassian.jira.web.bean.I18nBean
  recipient - com.opensymphony.user.User
  velocityCount - java.lang.Integer
  attachments - java.util.ArrayList
  remoteUser - com.opensymphony.user.User
  userutils - com.atlassian.core.user.UserUtils
  applicationProperties - com.atlassian.jira.config.properties.ApplicationPropertiesImpl
  padSize - java.lang.Integer
  customFieldManager - com.atlassian.jira.issue.managers.DefaultCustomFieldManager
  issue - com.atlassian.jira.mail.TemplateIssue
  jirautils - com.atlassian.jira.util.JiraUtils
  params - java.util.HashMap
  projectManager - com.atlassian.jira.project.CachingProjectManager
  velocityhelper - com.atlassian.jira.util.JiraVelocityHelper
  timeSpentFieldId - java.lang.String
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 25, 2015

Helpful info. Thank you Andrew!

Holger Schimanski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 25, 2018
TAGS
AUG Leaders

Atlassian Community Events