---
title: "Join SLA search functions"
canonical: "https://support.appfire.com/space/TTS/54755610/Join%20SLA%20search%20functions"
format: markdown
---
> Macro (aura-html)

The `slaJoin` function ensures that all SLA conditions in a JQL query apply to the same SLA within an issue. This is useful when searching for issues with multiple SLAs, where standard JQL queries may return unintended results.

## Prerequisites

Before using `slaJoin`, ensure the following:

- You are familiar with JQL. [Learn more](https://confluence.atlassian.com/jirasoftwareserver073/advanced-searching-861256227.html).
- You are in Advanced search mode in Jira (<u>SLA functions are not available in Basic mode</u>).

## Problem with standard SLA queries

By default, Time to SLA allows multiple SLAs per issue. This can lead to incorrect results when using direct SLA JQL queries.

### Example 1:

The following query searches for issues where an SLA has finished and breached:

```
slaFunction = isFinished() AND slaFunction = isBreached()
```

However, this query may return incorrect results.

**Scenario**

- Issue TP-1 contains two SLAs:
  - SLA 1 is finished.
  - SLA 2 is running but has breached.

Since SLA 1 meets** **`isFinished()`** **and SLA 2 meets** **`isBreached()`, issue TP-1 appears in the results—even though no single SLA meets both conditions.

## Solution: Using `slaJoin`

To ensure that both conditions apply to the same SLA within an issue, use the slaJoin function:

```
slaFunction = slaJoin("slaFunction = isFinished() AND slaFunction = isBreached()")
```

Now, the query returns only issues where a single SLA is both finished and breached. Issue TP-1 is no longer included in the results.

## Key rules for `slaJoin`

- All functions inside** **`slaJoin`** **must be SLA 3.0 JQL functions.
- Inner queries can only use SLA-related parameters (for example, duration, date, or percentage).
- To restrict results to specific SLAs, include the SLA ID or SLA Name in the query.

## Using `slaJoin` for complex queries

You can use more complex queries inside the `slaJoin` function.

### Example 1:

The following query returns:

- Issues where an SLA is both finished and breached
- OR issues where an SLA is running and has exceeded 90% of its duration

```
slaFunction = slaJoin("(slaFunction = isFinished() AND slaFunction = isBreached()) OR (slaFunction = isRunning() AND slaFunction >= elapsedPercentage(90))")
```

### Example 2:

The JQL given below will filter and select issues that have breached their SLA and have a target date before January 1, 2023. It helps identify and prioritize issues that have missed their deadlines based on the defined SLA criteria.

```
slaFunction = slaJoin("slaFunction = isBreached() AND slaFunction < slaTargetDate('2023-01-01')")
```