# Conditions

Sub condition

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FErQbgnR4G0jH3qbHpTFO%2Frules_6.png?alt=media&#x26;token=5e5f3c1b-c3c0-4536-a78d-b05331aa70e6" alt=""><figcaption></figcaption></figure>

The app supports two logical operators:

* AND operator.
* OR operator.

### Check if any of the finders fit an issue in the system

This is the most common usage of this condition. In the below example, the condition checks if the finders have any issue results.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FgmIGmFmsr6D06WoKYqfJ%2Frules_1.png?alt=media&#x26;token=4bc8e7f1-6f16-451b-a5b6-e0eb7d8187db" alt=""><figcaption></figcaption></figure>

### Check if an issue is previously created by the Mail Handler

In some special cases, it should be checked if an issue was previously created. The below example represents an Update issue (Set Labels) that will be executed only IF any of the above, same-level IF conditions are true. In other terms, if the email's Subject matches the regex STM.\* or TEMP.\* the Labels field will be set to the added Manual value. Else, if the issue already existed before, the Assignee field will be set to a Manual value. For viewing purposes, the screenshot was added in two&#x20;

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FjIePjGSL9v4x3EW2zuA4%2Frule_7.2.png?alt=media&#x26;token=5131227b-f4f9-46bc-a933-986934de2368" alt=""><figcaption></figcaption></figure>

## Email content matches <a href="#conditions-emailcontentmatches" id="conditions-emailcontentmatches"></a>

This condition checks whether parts of the emails match with a given regexp.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FpJ2ZFSCU8EgoPp6u2fZi%2Frules_8.png?alt=media&#x26;token=01733569-e0b2-42b7-920a-698c11944a58" alt=""><figcaption></figcaption></figure>

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FHEKjj3CDzUGiooSYKPT5%2Frules_9.png?alt=media&#x26;token=ff79bad4-1c93-4e42-80bf-890c636a6d32" alt=""><figcaption></figcaption></figure>

The fields that can be set here are the followings:

#### Email part

* Body
* Subject
* Header
* To addresses
* Cc addresses
* To/Cc addresses
* From address
* From name

#### Header name

If the "Header" email part is selected, this field appears to allow defining the header's name.\
The header name search is case-insensitive.\
If the defined header is not present in the email, the result of this condition will be false.

#### Negation of the result

* matches regexp -> true if the regexp fits the selected email part. \
  **Example**: \
  Email's body: "The email content."\
  Regexp: email\
  Result of this condition: true
* not matches regexp -> true if the regexp does not fit the selected email part\
  **Example**\
  Email's body: "The email content."\
  Regexp: email\
  Result of this condition: false

#### Regular expression

A regular expression that fits with any part of the email.\
Documentation can be found [here](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html).

## Issue field matches

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FqfwB8pHFI6kJcp1qI2xF%2Frules_10.png?alt=media&#x26;token=c03ea430-f460-4591-b224-334e2655d897" alt=""><figcaption></figcaption></figure>

This condition checks a field of an issue.

{% hint style="warning" %}
This condition only works correctly, if you have an existing issue at this point of the execution. If there is no issue when the execution calls this condition, the result will be **false**.
{% endhint %}

The following fields can be set:

#### Field&#x20;

Currently, we support only the **Status** field

#### Negation of the result

* equals
* not equals

#### Value&#x20;

The Field's value.

## &#x20;<a href="#conditions-senderhasnoaccesstotheissue" id="conditions-senderhasnoaccesstotheissue"></a>

## Sender has NO access to the issue <a href="#conditions-senderhasnoaccesstotheissue" id="conditions-senderhasnoaccesstotheissue"></a>

This condition checks if the sender has permission to open the issue by checking the **BROWSE\_PROJECTS** permission. A customer also has **BROWSE\_PROJECTS** permission if added as a Request Participant.

If the sender has no access to the page, the action in the IF statement is executed.

{% hint style="warning" %}
For proper working please be sure if there is a find or created issue in the context.

If there is no issue at this point of the execution, then the app checks the global permission of the user. For more details, please check the Atlassian [documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-permissions/#api-rest-api-2-mypermissions-get).
{% endhint %}

## Sender is member of any of the groups

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FnXo2WFrJe8hjQ2XRqtK5%2Frules_11.png?alt=media&#x26;token=b14b271c-df2d-4ba7-a6a3-31507fd314e1" alt=""><figcaption></figcaption></figure>

This condition checks if the sender is a member of any of the given groups.

##

## Sender is member of any of the project roles

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2Fn19X3kvmtfugYMIC2GFd%2Frules_12.png?alt=media&#x26;token=04681081-928e-451e-aa2c-0cfe8f18c8b9" alt=""><figcaption></figcaption></figure>

This condition checks if the sender has the given project role(s) in the given project.

##

## Issue matches query

This condition allows running a JQL query on the issue in the context.

Please make sure there is an issue in the context, where you add this condition.\
A good practice, if you add an "Issue Exists" condition before this one.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2Fn3Qajtxzg2ITExuEYwgz%2Frules_13.png?alt=media&#x26;token=2a57cb8d-6c1c-40bd-86c0-07828efa81cf" alt=""><figcaption></figcaption></figure>

If the JQL should contain a user, please select "Insert user" option below.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FkowSAcm5s1hPr09TFo6D%2Frules_14.png?alt=media&#x26;token=8a56d447-0168-4f69-86c6-d28f34ef4078" alt=""><figcaption></figcaption></figure>

## &#x20;<a href="#conditions-senderhasnoaccesstotheissue" id="conditions-senderhasnoaccesstotheissue"></a>

## Email sender is unkown <a href="#conditions-senderhasnoaccesstotheissue" id="conditions-senderhasnoaccesstotheissue"></a>

This condition checks if the sender has a user account on the Jira instance.

If the sender has no user account, the action in the IF statement is executed. Disabled users are handled as non-existing.
