# JQL Functions

JQL Functions are provided to search for issues against the Email Audit Log.

<mark style="color:green;">SINCE 5.4.0.7</mark>

## Search for issues created by email <a href="#jqlfunctions-searchforissuescreatedbyemail" id="jqlfunctions-searchforissuescreatedbyemail"></a>

Usage in JQL: `issue in createdByEmail(senderEmailAddress,dateFrom, dateTo, containingText)`

Parameters are optional:

* `senderEmailAddress`: email address of the sender of the email.
* `dateFrom`, `dateTo`: these are date values in format of dd/MM/yyyy (as 31/03/2021) or durations like 5d or 3h, etc.
* `containingText`: search the email subject for substring, you can use SQL wildcards like ? and %

## Search for issues commented by email <a href="#jqlfunctions-searchforissuescommentedbyemail" id="jqlfunctions-searchforissuescommentedbyemail"></a>

Usage in JQL: `issue in commentedByEmail(senderEmailAddress,dateFrom, dateTo, containingText)`

Parameters are optional:

* `senderEmailAddress`: email address of the sender of the email.
* `dateFrom`, `dateTo`: these are date values in format of dd/MM/yyyy (as 31/03/2021) or durations like 5d or 3h, etc.
* `containingText`: search the email subject for substring, you can use SQL wildcards like ? and %

## Search for issues sent in email <a href="#jqlfunctions-searchforissuessentinemail" id="jqlfunctions-searchforissuessentinemail"></a>

Usage in JQL: `issue in sentInEmail(searchParams)`

The parameter is a construct of multiple fields. The parameter itself and its fields are optional.

### Fields in Search Parameter <a href="#jqlfunctions-fieldsinsearchparameter" id="jqlfunctions-fieldsinsearchparameter"></a>

| Field    | Description                                                                                                                                                                                                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| to       | The recipient to whom the email was sent, SQL wildcards are allowed.                                                                                                                                                                                                                                   |
| cc       | The copy recipient to which the email was sent, SQL wildcards are allowed.                                                                                                                                                                                                                             |
| bcc      | The blind copy recipient to which the email was sent, SQL wildcards are allowed.                                                                                                                                                                                                                       |
| sender   | The Jira full name (displayName) of the sender.                                                                                                                                                                                                                                                        |
| dateFrom | Date in format of dd/MM/yyyy (as 31/03/2021) or durations like 5d or 3h, etc.                                                                                                                                                                                                                          |
| dateTo   | Date in format of dd/MM/yyyy (as 31/03/2021) or durations like 5d or 3h, etc.                                                                                                                                                                                                                          |
| source   | <ul><li>OPERATION: email sent manually</li><li>BULK: email sent in bulk operation</li><li>EVENT: email sent by Jira Email This Issue event notification</li><li>WORKFLOW: email sent by Jira Email This Issue post function</li><li>AUTOREPLY: email sent as autoreply for an incoming email</li></ul> |
| subject  | The subject of the email that was sent, wildcards are accepted.                                                                                                                                                                                                                                        |
| issue    | The key of the issue that was sent.                                                                                                                                                                                                                                                                    |

{% hint style="info" %}
**Note**: All fields can be combined into a search, they are ANDed in the query

If none of the fields is specified, query spans over to, cc, bcc (see below).
{% endhint %}

### Example <a href="#jqlfunctions-examples" id="jqlfunctions-examples"></a>

| Example                                                                                                                                                                          | Result                                                                                                                                                                                            |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `issue in sentInEmail( "john@company.com")`                                                                                                                                      | Issues that were sent to <john@company.com> (either to or cc or bcc).                                                                                                                             |
| `issue in sentInEmail("to=john@company.com, sender=A Wilson, dateFrom=22/04/2020, dateTo=5d")`                                                                                   | Issues that were sent by user "A Wilson", to <john@company.com>, between April 22, 2020 and 5 days ago.                                                                                           |
| `issue in sentInEmail( "to=john@company.com, cc=anne@mycompany.com, bcc=projectemailaddress@mycompany.com, sender=A Wilson, dateFrom=22/04/2020, dateTo=-5d, source=OPERATION")` | Issues that were sent by user "`A Wilson`", to <john@company.com>, copied to <anne@mycompany.com>, bcced to <projectemailaddress@mycompany.com>, between April 22, 2020 and 5 days ago, manually. |
| `issue in sentInEmail( "issue=FOO-13")`                                                                                                                                          | The FOO-13 issue, if it was sent.                                                                                                                                                                 |


---

# 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.meta-inf.hu/email-this-issue/email-this-issue-for-jira-server-data-center/documentation/jql-functions.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.
