Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Section


Column


Excerpt

A variable looks up a value from the template context. This documents details on the variables available in JMWE and how to create custom variables.

If you want to insert the value of a variable in your template, you can use the following syntax: {{ myVar }}This looks up for the myVar variable from the context and displays it. Variable names can have dots in them which look up properties, just like in javascript.


Column
width400px


Panel
borderColorsilver
bgColor#f5f5f5
borderWidth1
borderStylesolid

On this page:

Table of Contents



Variables available in JMWE

JMWE makes the issue, transition, linkedIssue, parentIssue, now and currentUser variables available to templates. You can access their properties using "." or "[ ]". For example, you can access the current issue key using {{issue.key}}.

issue variable

The issue variable is used to insert data of the issue being transitioned. You can access the issue data by looking up at its properties.

...

{{issue.fields.labels}} returns an array of label values, e.g. [ "1","2" ]

{{issue.fields.reporter.nameaccountId}} returns the username accountId of the reporter, e.g. carter

Expand
titleClick here to see some properties of the issue variable


Properties

Description

issue.idInternal Id number of the issue
issue.keyIssue key
issue.fields.summaryIssue summary
issue.fields.descriptionIssue description
issue.fields.issuetype.nameIssue type
issue.fields.issuetype.descriptionIssue type description
issue.fields.creator.nameUsername of the person who created the issue
issue.fields.creator.emailAddressEmail address of the person who created the issue
issue.fields.creator.displayNameDisplays name of the person who created the issue
issue.fields.creator.timeZoneTime zone of the creator
issue.fields.reporter.nameaccountIdUsername AccountId of the person who reported the issue
issue.fields.reporter.emailAddressEmail address of the person who reported the issue
issue.fields.reporter.displayNameDisplay name of the person who reported the issue
issue.fields.reporter.timeZoneTime zone of the reporter
issue.fields.assignee.nameaccountIdUsername AccountId of the person assigned to the issue
issue.fields.assignee.emailAddressEmail address of the person assigned to the issue
issue.fields.assignee.displayNameDisplay name of the person assigned to the issue
issue.fields.assignee.timeZoneTime zone of the assignee
issue.fields.createdDate and time the issue was created
issue.fields.updatedDate and time the issue was last updated
issue.fields.priority.nameIssue priority name
issue.fields.project.nameIssue project name
issue.fields.project.keyIssue project key
issue.fields.lastViewedDate and time the issue was last viewed by the current user
issue.fields.fixVersions[0].nameName of the first fix Version/s
issue.fields.fixVersions[0].descriptionDescription of the first fix Version/s
issue.fields.fixVersions[0].releaseDateRelease date of the first Fix Version/s
issue.fields.versions[0].nameName of the first Affects Version/s
issue.fields.versions[0].descriptionDescription of the first Affects Version/s
issue.fields.versions[0].releaseDateRelease date of the first Affects Version/s
issue.fields.components[0].nameName of the first component
issue.fields.components[0].descriptionDescription of the first component
issue.fields.duedateDue date of the issue
issue.fields.timespentTime spent on the issue
issue.fields.timeoriginalestimateThe original estimate of the time required to resolve the issue
issue.fields.resolution.nameResolution of the issue
issue.fields.watches.watchcountThe number of people watching the issue
issue.fields.labelsLabels the issue relates to
issue.fields.environmentThe hardware or software environment the issue relates to
issue.fields.votesThe number of votes an issue has


...

Expand
titleClick here to see the properties of the transition variable


PropertiesDescription
transition.transitionNameName of the current transition
transition.transitionIdNumerical ID of the current transition
transition.from_statusSource status of the transition
transition.to_statusDestination status of the transition
transition.workflowNameName of the current workflow
transition.workflowIdNumerical ID of the current workflow


newIssueKey

The newIssueKey variable holds the key of the newly created issue. This is applicable only in the Create/Clone issue post-function. 

For example:

{{newIssueKey}} returns the key of the newly created issue.

Issue {{newIssueKey}} has been created.

linkedIssue variable

The linkedIssue variable, which is only available from post-functions that work on linked issues, is used to insert data of the linked issue being processed by the post-function.

...

Expand
titleClick here to see the properties of the linkedIssue variable


Properties

Description

linkedIssue.idInternal Id number of the linked issue
linkedIssue.keyLinked issue key
linkedIssue.fields.summaryLinked issue summary
linkedIssue.fields.descriptionLinked issue description
linkedIssue.fields.issuetype.nameLinked issue type
linkedIssue.fields.issuetype.descriptionLinked issue Issue type description
linkedIssue.fields.creator.nameaccountIdUsername Account Id of the person who created the linked issue
linkedIssue.fields.creator.emailAddressEmail address of the person who created the linked issue
linkedIssue.fields.creator.displayNameDisplays name of the person who created the linked issue
linkedIssue.fields.creator.timeZoneTime zone of the creator
linkedIssue.fields.reporter.nameaccountIdUsername Account Id of the person who reported the linked issue
linkedIssue.fields.reporter.emailAddressEmail address of the person who reported the linked issue
linkedIssue.fields.reporter.displayNameDisplay name of the person who reported the linked issue
linkedIssue.fields.reporter.timeZoneTime zone of the reporter
linkedIssue.fields.assignee.nameaccountIdUsername Account Id of the person assigned to the linked issue
linkedIssue.fields.assignee.emailAddressEmail address of the person assigned to the linked issue
linkedIssue.fields.assignee.displayNameDisplay name of the person assigned to the linked issue
linkedIssue.fields.assignee.timeZoneTime zone of the assignee
linkedIssue.fields.createdDate and time the linked issue was created
linkedIssue.fields.updatedDate and time the linked issue was last updated
linkedIssue.fields.priority.nameLinked Issue priority name
linkedIssue.fields.project.nameLinked Issue project name
linkedIssue.fields.project.keyLinked Issue project key
linkedIssue.fields.lastViewedDate and time the linked issue was last viewed by the current user
linkedIssue.fields.fixVersions[0].nameName of the first Fix Version/s
linkedIssue.fields.fixVersions[0].descriptionDescription of the first Fix Version/s
linkedIssue.fields.fixVersions[0].releaseDateRelease date of the first Fix Version/s
linkedIssue.fields.versions[0].nameName of the first Affects Version/s
linkedIssue.fields.versions[0].descriptionDescription of the first Affects Version/s
linkedIssue.fields.versions[0].releaseDateRelease date of the first Affects Version/s
linkedIssue.fields.components[0].nameName of the first component
linkedIssue.fields.components[0].descriptionDescription of the first component
linkedIssue.fields.duedateDue date
linkedIssue.fields.timespentTime spent
linkedIssue.fields.timeoriginalestimateThe original estimate of the time required to resolve the linked issue
linkedIssue.fields.resolution.nameResolution of the issue
linkedIssue.fields.watches.watchcountThe number of people watching the linked issue
linkedIssue.fields.labelsLabels the linked issue relates to
linkedIssue.fields.environmentThe hardware or software environment the linked issue relates to
linkedIssue.fields.votesThe number of votes a linked issue has


...

The parentIssue variable, which is only available from post-functions that work on the parent issue, is used to insert data of the parent issue being processed by the post-function.

For example:

{{parentIssue.fields.priority.name}} returns the priority of the parent issue being processed.

Expand
titleClick here to see the properties of the parentIssue variable


Properties

Description

parentIssue.idInternal Id number of the parent issue
parentIssue.keyParent issue key
parentIssue.fields.summaryParent issue summary
parentIssue.fields.descriptionParent issue description
parentIssue.fields.issuetype.nameParent issue type
parentIssue.fields.issuetype.descriptionParent issue Issue type description
parentIssue.fields.creator.nameaccountIdUsername Account Id of the person who created the parent issue
parentIssue.fields.creator.emailAddressEmail address of the person who created the parent issue
parentIssue.fields.creator.displayNameDisplays name of the person who created the parent issue
parentIssue.fields.creator.timeZoneTime zone of the creator
parentIssue.fields.reporter.nameaccountIdUsername Account Id of the person who reported the parent issue
parentIssue.fields.reporter.emailAddressEmail address of the person who reported the parent issue
parentIssue.fields.reporter.displayNameDisplay name of the person who reported the parent issue
parentIssue.fields.reporter.timeZoneTime zone of the reporter of the parent issue
parentIssue.fields.assignee.nameaccountIdUsername Account Id of the person assigned to the parent issue
parentIssue.fields.assignee.emailAddressEmail address of the person assigned to the parent issue
parentIssue.fields.assignee.displayNameDisplay name of the person assigned to the parent issue
parentIssue.fields.assignee.timeZoneTime zone of the assignee of the parent issue
parentIssue.fields.createdDate and time the parent issue was created
parentIssue.fields.updatedDate and time the parent issue was last updated
parentIssue.fields.priority.nameParent Issue priority name
parentIssue.fields.project.nameParent Issue project name
parentIssue.fields.project.keyParent Issue project key
parentIssue.fields.lastViewedDate and time the parent issue was last viewed by the current user
parentIssue.fields.fixVersions[0].nameName of the first Fix Version/s
parentIssue.fields.fixVersions[0].descriptionDescription of the first Fix Version/s
parentIssue.fields.fixVersions[0].releaseDateRelease date of the first Fix Version/s
parentIssue.fields.versions[0].nameName of the first Affects Version/s
parentIssue.fields.versions[0].descriptionDescription of the first Affects Version/s
parentIssue.fields.versions[0].releaseDateRelease date of the first Affects Version/s
parentIssue.fields.components[0].nameName of the first component
parentIssue.fields.components[0].descriptionDescription of the first component
parentIssue.fields.duedateDue date
parentIssue.fields.timespentTime spent
parentIssue.fields.timeoriginalestimateThe original estimate of the time required to resolve the parent issue
parentIssue.fields.resolution.nameResolution of the parent issue
parentIssue.fields.watches.watchcountThe number of people watching the parent issue
parentIssue.fields.labelsLabels the parent issue relates to
parentIssue.fields.environmentThe hardware or software environment the parent issue relates to
parentIssue.fields.votesThe number of votes a parent issue has


...

The currentUser variable is used to insert information about the current user, i.e. the user triggering the transition. Only two properties of the current user are available: key and name. To set a user-type field (such as Assignee, Reporter, or any custom User-picker field), use the name property.

For example:

{{currentUser.nameaccountId}} returns the name accountId of the user triggering the transition, e.g. carteraccountId:5ca5b1469a000c1180956957. Use this to set a user-type field (such as Assignee, Reporter, or any custom User-picker field)

{{currentUser.key}} returns the key of the user triggering the transition, e.g. carter001

now variable

The now variable is used to insert the current date and time. This is useful to save a transition's execution date/time in a custom field. 

...

The nowObj variable represents now138446514 as a Moment.js object. 

For example:

{{ nowObj }} returns now 138446514 as a Moment.js object. 

{{ nowObj | date }} returns current date as a date Object

{{ issue.fields.duedate | date('clone') <= nowObj }} returns true if the ticket is overdue.

User-defined variables

In addition to the above variables, you can also create your own variables within the template using the set Nunjucks tag.

For example:

{% set x = "High" %} sets the value of the variable x to High. You can also set the variable to an object. For example: {% set assignee = issue.fields.assignee %}