Page tree
Skip to end of metadata
Go to start of metadata

Velocity enables you to use a number of variables and call methods on specific objects. When writing PocketQuery for Jira templates, the following variables and objects are available:

Additionally, there are various objects available that are specific to PocketQuery for Jira:


$result (List of Map<String,Object>)

The result of the query. This is a List of Maps, e.g.:

{Name: 'Germany', Continent: 'Europe', Region: 'Western Europe'},
{Name: 'Sweden', Continent: 'Europe', Region: 'Nordic Countries'}
$pocketErrors (List) A list of errors (if any) that occured executing the PocketQuery for Jira app
$stackTrace (String) The stack trace of the last error (if any)
$debug (Boolean)True if debug mode is enabled, false otherwise
$issue (Issue)

The current Jira issue

$project (Project)The current Jira project
$user (User)The current Jira user

App parameters

$processedMacroParameters (Map<String,Object>)Parameters set for the macro, each of them is also directly accessible. Includes the options debug, dynamicloadinitially, as well as the queryname and the queryparameterstring (parameter map as string).
$debug (Boolean)Whether or not the debug option is enabled
$dynamicloadinitially (Boolean)Whether or not the option "Load macro dynamically" is enabled


$query (Query)The query object (contains all fields of a query entity described above)
$queryName (String)The name of the query
$queryparameterstring (String)Map queryparameters formatted as String.
$queryParameters (Map<String, Object>)Parameters that were given to the query in the PocketQuery for Jira macro (in the macro browser or by GET parameters)
$queryExecutionTime (Long)Time in milliseconds the database transaction took
$rawResult (Object)Raw query result


$date (Date)Date object, initialized to the time of app execution
$dateFormatter (DateFormatter)DateFormatter object for Confluence-oriented date formatting
$numberTool (NumberTool)NumberTool object for number formatting
$math (MathTool)MathTool object for advanced math operations
$sums (Map<String, Long>)Contains the summed up values of all columns of the result that contain only numeric values. Each value can be accessed using $sums.get("columnName") or $sums.columnName


The PocketQuery for Jira Velocity Helper

In addition to the objects above, there is a global Velocity helper object available in PocketQuery for Jira templates that contains some utility methods. You can access this helper with the context key $PocketQuery. Below you find a list of the methods that are currently available.

PocketQuery for Jira Specific / Templating

$PocketQuery.dataTags(Map<String, Object> params)

@param params Map of parameters for data attributes
@return generated data attributes string

Will produce an HTML data attributes string from the given parameters. If a map like { one: ‘1’, two: ‘2’ } is given, the result will be ‘data-one=”1” data-two=”2”‘. Example in Velocity templates:

<div $PocketQuery.dataTags({ "language":"German", "country":"Germany" })>
	My div with data attributes

This will produce:

<div data-language="German" data-country="Germany">
	My div with data attributes

Continue with "Getting Started"

  • No labels