# Introduction to Jira Expressions

{% hint style="info" %}
Press Ctrl + Space anywhere inside Jira expression field to get suggestions including available context variables, properties and methods.
{% endhint %}

## Syntax

Start writing expression by typing `issue` or any other available [context variable](#context-variables). 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`.&#x20;

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 [Jira expressions type reference](https://developer.atlassian.com/cloud/jira/software/jira-expressions-type-reference/).&#x20;

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.&#x20;

```javascript
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 [Jira expressions documentation](https://developer.atlassian.com/cloud/jira/software/jira-expressions/).

## Context Variables

The following context variables are available to expressions:

* `user` ([User](https://developer.atlassian.com/cloud/jira/platform/jira-expressions-type-reference#user)): The user the condition is evaluated for.
* `issue` ([Issue](https://developer.atlassian.com/cloud/jira/platform/jira-expressions-type-reference#issue)): The issue selected for the transition.
* `project` ([Project](https://developer.atlassian.com/cloud/jira/platform/jira-expressions-type-reference#project)): The project the issue belongs to.
* `transition` ([Transition](https://developer.atlassian.com/cloud/jiraplatform/jira-expressions-type-reference#transition)): The transition that the condition is being evaluated against.
* `workflow` (Workflow): The workflow that contains the condition

Additionally, these are available in Validators:

* `originalIssue` ([Issue](https://developer.atlassian.com/cloud/jira/platform/jira-expressions-type-reference#issue)): The issue *before* changes were made on the transition screen. This variable is not available when validator is defined for the [initial transition](https://support.atlassian.com/jira-cloud-administration/docs/configure-the-initial-status/).

Additionally, these are available for Jira Service Desk transitions:

* `customerRequest` ([CustomerRequest](https://developer.atlassian.com/cloud/jira/platform/jira-expressions-type-reference#customerrequest)): The customer request selected for transition. It is not available on initial transition (Create issue).
* `serviceDesk` ([ServiceDesk](https://developer.atlassian.com/cloud/jira/platform/jira-expressions-type-reference#servicedesk)): The service desk the customer request belongs to.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forgappify.com/workflow-building-blocks-for-jira/writing-jira-expressions/introduction-to-jira-expressions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
