Workflow Building Blocks for Jira
  • About Workflow Building Blocks for Jira
  • Administrator Guide
    • Setup Conditions and Validators
  • Conditions & Validators
    • 🚀 Ultimate Condition & Validator
    • Linked Issues Condition & Validator
    • Dates Compare Condition & Validator
    • Fields Required Condition & Validator
    • Jira Expression Condition & Validator
  • Writing Jira Expressions
    • Introduction to Jira Expressions
    • Jira expressions library
    • Writing validation messages
  • Testing & Debugging
    • Testing Conditions & Validators
    • Limitiations
  • Support
    • Service Desk
  • Atlassian Marketplace Apps
    • Workflow Building Blocks for Jira
    • Translated Fields for Jira & JSM
    • Field Rules - UI Modifications for Jira
Powered by GitBook
On this page
  • Syntax
  • Context Variables
  1. Writing Jira Expressions

Introduction to Jira Expressions

PreviousJira Expression Condition & ValidatorNextJira expressions library

Last updated 2 months ago

Press Ctrl + Space anywhere inside Jira expression field to get suggestions including available context variables, properties and methods.

Syntax

Start writing expression by typing issue or any other available . You can access any properties or methods of an issue using . notation. Press Ctrl + Space inside the editor to get all possible members you can access. For example, to read the assignee of the issue, type: issue.assignee. Custom fields can be accessed by field id: issue.customfield_10036.

The next step is to use one of the comparison operators: ==, !=, <, >, <=, >= followed by a value. For example, in order to check if an issue is assigned, use: issue.assignee != null.

Each member has its own type and properties. To check that Jane Doe is assigned to the issue, type: issue.assignee?.displayName == "Jane Doe". Note that we used ?. notation to prevent syntax errors in case the assignee is null (type null does not have any properties).

All types are described in details in .

Expression can be combined using || or && logical operators and even grouped with parenthesis. It is also possible to create local variables for clarity, e.g.

let versions = issue.versions || issue.fixVersions;
versions?.length > 1

Jira expressions use JavaScript-like syntax. They support a subset of JavaScript constructs and features which are described in details in .

Context Variables

The following context variables are available to expressions:

  • user (): The user the condition is evaluated for.

  • issue (): The issue selected for the transition.

  • project (): The project the issue belongs to.

  • transition (): The transition that the condition is being evaluated against.

  • workflow (Workflow): The workflow that contains the condition

Additionally, these are available in Validators:

Additionally, these are available for Jira Service Desk transitions:

originalIssue (): The issue before changes were made on the transition screen. This variable is not available when validator is defined for the .

customerRequest (): The customer request selected for transition. It is not available on initial transition (Create issue).

serviceDesk (): The service desk the customer request belongs to.

Issue
initial transition
CustomerRequest
ServiceDesk
Jira expressions type reference
Jira expressions documentation
User
Issue
Project
Transition
context variable