SLA Search 3.0 JQL Functionalities

This page is about Time to SLA for Jira Server users.
This page requires some knowledge of searching for issues using JQL. If you need a detailed introduction to JQL usage, please click here to get more information. Due to the limitations of the issue navigator, it's not possible to search for the SLAs in the Basic mode.

What is slaFunction?

The Time to SLA plugin adds the slaFunction custom field upon installation. You cannot add this custom field to screens but use it for JQL search. This design allows a better plugin performance. Click here if you want to check out former JQL functions.


State functions

State Functions filter issues for a given state of SLA. These functions check state equality so you can only use = or != as operands.
FunctionDescriptionExample

isNotStarted([Optional List of SLA IDs or/and Name(s)])

Finds issues that have at least one inactive SLA on it.

slaFunction = isNotStarted()

slaFunction = isNotStarted(SLAid1,SLAid2)

slaFunction = isNotStarted("SLA Name 1","SLA Name 2")

isFinished([Optional List of SLA IDs or/and Name(s) ])

Finds issues that have at least one finished SLA on it.


slaFunction = isFinished()

slaFunction = isFinished(SLAid1,SLAid2)

slaFunction = isFinished("SLA Name 1","SLA Name 2")

isRunning([Optional List of SLA IDs or/and Name(s)])

Finds issues that have at least one running SLA on it.


slaFunction = isRunning()

slaFunction = isRunning(SLAid1,SLAid2)

slaFunction = isRunning("SLA Name 1","SLA Name 2")

isPaused([Optional List of SLA IDs or/and Name(s)])

Finds issues that have at least one paused SLA on it.


slaFunction = isPaused()

slaFunction = isPaused(SLAid1,SLAid2)

slaFunction = isPaused("SLA Name 1","SLA Name 2")


Duration functions

Duration Functions filter issues by their SLA durations. These functions compare duration so you can only use '>', '>=', '<' and '<=' as operands.
Calendars of the SLAs are taken into consideration while interpreting the given duration strings.
FunctionDescriptionExample

remainingDuration(Duration, [Optional List of SLA IDs or/and Name(s)])


This function compares the given duration with the remaining duration of SLAs and finds issues if at least one SLA satisfies the comparison.


slaFunction <= remainingDuration("4h")

slaFunction < remainingDuration("1d", 5, 7)

slaFunction < remainingDuration("1d", "SLA Name 1","SLA Name 2")

slaFunction >= remainingDuration("5d", 2, 6, 12)

slaFunction >= remainingDuration("5d", "SLA Name 1","SLA Name 2", "SLA Name 3")

slaFunction > remainingDuration("5d", 2, 6, 12)

slaFunction > remainingDuration("5d","SLA Name 1","SLA Name 2", "SLA Name 3")

elapsedDuration(Duration, [Optional List of SLA IDs or/and Name(s)])


This function compares the given duration with the elapsed duration of SLAs and finds issues if at least one SLA satisfies the comparison.


slaFunction <= elapsedDuration("4h")

slaFunction < elapsedDuration("1d", 5, 7)

slaFunction < elapsedDuration("1d", "SLA Name 1","SLA Name 2")

slaFunction >= elapsedDuration("5d", 2, 6, 12)

slaFunction >= elapsedDuration("5d", "SLA Name 1","SLA Name 2""SLA Name 3")

slaFunction > elapsedDuration("5d", 2, 6, 12)

slaFunction > elapsedDuration("5d", "SLA Name 1","SLA Name 2""SLA Name 3")

breachDuration(Duration, [Optional List of SLA IDs or/and Name(s)])


This function compares the given duration with the breach duration of SLAs and finds issues if at least one SLA satisfies the comparison.


slaFunction <= breachDuration("4h")

slaFunction < breachDuration("1d", 5, 7)

slaFunction < breachDuration("1d", "SLA Name 1","SLA Name 2")

slaFunction >= breachDuration("5d", 2, 6, 12)

slaFunction >= breachDuration("5d", "SLA Name 1","SLA Name 2""SLA Name 3")

slaFunction > breachDuration("5d", 2, 6, 12)

slaFunction > breachDuration("5d", "SLA Name 1","SLA Name 2""SLA Name 3")


Date functions

Date Functions filter issues by their SLA date values. These functions compare dates so you can only use '>', '>=', '<' and '<=' as operands.
If duration strings are used instead of giving an exact date to compare to, calendars of the SLAs will be taken into consideration while interpreting them.

Time Functions are the same as Jira functions. Time Functions;

startOfDay(), startOfWeek(), startOfMonth(), startOfYear(), endOfDay(), endOfWeek(), endOfMonth(), endOfYear()

Usage;

startOfMonth() → Start of current month

startOfMonth(inc) = startOfMonth(+1) = startOfMonth(+1M) → All of them get start of next month

startOfMonth(-1) = startOfMonth(-1M) → Both of them get start of last month

inc → Increment of period same as +1

Time functions parameter can be (+|-) nn (y|M|w|d|h|m)

FunctionDescriptionExample

slaStartDate(Date or Duration or timeFunction, [Optional List of SLA IDs or/and Name(s)])


This function compares the given date or the given duration string with the start date of SLAs and finds issues if at least one SLA satisfies the comparison.

slaFunction <= slaStartDate("2019-07-01")

slaFunction < slaStartDate("-5d")

slaFunction > slaStartDate("-20d", 4, 6, 8)

slaFunction > slaStartDate("-20d", "SLA Name 1","SLA Name 2""SLA Name 3")

slaFunction >= slaStartDate("2019-04-01 13:00", 1, 2)

slaFunction >= slaStartDate("2019-04-01 13:00", "SLA Name 1","SLA Name 2")

slaFunction > slaStartDate("endOfMonth(-1)")

slaFunction > slaStartDate("startOfDay(+2h)", 1)

slaFunction <= slaStartDate("endOfWeek(+2d)", 1 , 2)

slaTargetDate(Date or Duration or timeFunction, [Optional List of SLA IDs or/and Name(s)])


This function compares the given date or duration string with the target date of SLAs and finds issues if at least one SLA satisfies the comparison.


slaFunction <= slaTargetDate("2019-07-01")

slaFunction < slaTargetDate("-5d")

slaFunction > slaTargetDate("-20d", 4, 6, 8)

slaFunction > slaTargetDate("-20d", "SLA Name 1","SLA Name 2""SLA Name 3")

slaFunction >= slaTargetDate("2019-04-01 13:00", "SLA Name 1","SLA Name 2")

slaFunction > slaTargetDate("endOfMonth(+2w)")

slaFunction > slaTargetDate("startOfWeek(inc)", 1)

slaFunction <= slaTargetDate("endOfYear(-2M)", 1 , 2)

slaEndDate(Date or Duration or timeFunction, [Optional List of SLA IDs or/and Name(s)])


This function compares the given date or duration with the end date of SLAs and finds issues if at least one SLA satisfies the comparison.


slaFunction <= slaEndDate("2019-07-01")

slaFunction < slaEndDate("-5d")

slaFunction > slaEndDate("-20d", 4, 6, 8)

slaFunction > slaEndDate("-20d", "SLA Name 1","SLA Name 2""SLA Name 3")

slaFunction >= slaEndDate("2019-04-01 13:00", 1, 2)

slaFunction >= slaEndDate("2019-04-01 13:00", "SLA Name 1","SLA Name 2")

slaFunction > slaEndDate("startOfMonth(+2d)")

slaFunction > slaEndDate("endOfDay(-3h)", 1)

slaFunction <= slaEndDate("endOfYear(-2M)", 1 , 2)


Percentage functions

Percentage Functions filter issues by elapsed or remaining percentage of SLAs. These functions compare percentages so you can only use '>', '>=', '<' and '<=' as operands.
Only the following percentage values are valid for comparison: 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90
FunctionDescriptionExample

remainingPercentage(Percentage, [Optional List of SLA IDs or/and Name(s)])


This function compares the given percent with the remaining percentage of SLAs and finds issues if at least one SLA satisfies the comparison.

slaFunction <= remainingPercentage(10)

slaFunction > remainingPercentage(75)

slaFunction < remainingPercentage(25, 5, 7)

slaFunction < remainingPercentage(25, "SLA Name 1","SLA Name 2")

slaFunction >= remainingPercentage(50, 2, 6, 12)

slaFunction >= remainingPercentage(50, "SLA Name 1","SLA Name 2""SLA Name 3")

elapsedPercentage(Percent, [Optional List of SLA IDs or/and Name(s)])


This function compares the given duration with the elapsed percentage of SLAs and finds issues if at least one SLA satisfies the comparison.


slaFunction <= elapsedPercentage(10)

slaFunction > elapsedPercentage(75)

slaFunction < elapsedPercentage(25, 5, 7)

slaFunction < elapsedPercentage(25, "SLA Name 1","SLA Name 2")

slaFunction >= elapsedPercentage(50, 2, 6, 12)

slaFunction >= elapsedPercentage(50, "SLA Name 1","SLA Name 2""SLA Name 3")


Breach functions

Breach Functions filter issues for breach state. These functions check state equality so you can only use = or != as operands.
FunctionDescriptionExample

isBreached([Optional List of SLA IDs or/and Name(s)])


Finds issues that have at least one breached SLA on it.

slaFunction = isBreached()

slaFunction = isBreached(SLAid1,SLAid2)

slaFunction = isBreached("SLA Name 1","SLA Name 2")

Critical zone functions

Critical Zone Functions filter issues for the critical zone. These functions check SLA state equality so you can only use = or != as operands.
FunctionDescriptionExample

isInCriticalZone([Optional List of SLA IDs or/and Name(s)])


Finds issues that have at least one SLA in the critical zone.

slaFunction = isInCriticalZone()

slaFunction = isInCriticalZone(SLAid1,SLAid2)

slaFunction = isInCriticalZone("SLA Name 1","SLA Name 2")

Business Hours functions

Business Hours Functions filter issues for the SLA calendar's business hours. These functions check SLA state equality so you can only use = or != as operands.
FunctionDescriptionExample

isInBusinessHours([Optional List of SLA IDs or/and Name(s)])


Finds issues that have at least one SLA in business hours.

slaFunction = isInBusinessHours()

slaFunction = isInBusinessHours(SLAid1,SLAid2)

slaFunction = isInBusinessHours("SLA Name 1","SLA Name 2")

Contains SLA function

The Contains SLA Function filters issues for the presence of SLAs. This function checks SLA state equality so you can only use = or != as operands.
FunctionDescriptionExample

containsSla([List of at least 1 SLA ID or/and Name(s)])


Finds issues that contain the listed SLAs.

slaFunction = containsSla(SLAid1,SLAid2)

slaFunction = containsSla("SLA Name 1","SLA Name 2")

Complex functions

Complex Functions filter issues for a given complex state of SLA. These functions check state equality so you can only use = or != as operands.
FunctionDescriptionExample

isMet([Optional List of SLA IDs or/and Name(s)])


Finds issues that have at least one met SLA on it.

slaFunction = isMet()

slaFunction = isMet(SLAid1,SLAid2)

slaFunction = isMet("SLA Name 1","SLA Name 2")

isAllMet([Optional List of SLA IDs or/and Name(s)])


Finds issues that all SLAs are met on it.

slaFunction = isAllMet()

slaFunction = isAllMet(SLAid1,SLAid2)

slaFunction = isAllMet("SLA Name 1","SLA Name 2")

isNotBreachedAndNotFinished([Optional List of SLA IDs or/and Name(s)])


Finds issues that have at least one SLA which is not breached and not finished on it.

slaFunction = isNotBreachedAndNotFinished()

slaFunction = isNotBreachedAndNotFinished(SLAid1,SLAid2)

slaFunction = isNotBreachedAndNotFinished("SLA Name 1","SLA Name 2")

isAllNotBreachedAndNotFinished([Optional List of SLA IDs or/and Name(s)])


Finds issues that all SLAs which is not breached and not finished on it.

slaFunction = isAllNotBreachedAndNotFinished()

slaFunction = isAllNotBreachedAndNotFinished(SLAid1,SLAid2)

slaFunction = isAllNotBreachedAndNotFinished("SLA Name 1","SLA Name 2")



Joining SLA Functions

With SLA 3.0 JQL functions and slaFunction custom field you can easily search for your SLAs from indexes and you can have fast results without burdening your Jira. But since Time to SLA app gives you freedom of adding multiple SLAs to issues, directly searching them with these functions may not give you the exact result that you are searching for. For example you want to search for issues that have an SLA that has finished and breached so you run the following JQL query:

slaFunction = isFinished() AND slaFunction = isBreached()


But this is where the problem arises. Let's think of the following scenario:

  1. You have defined two SLAs: SLA 1 and SLA 2
  2. Both of these SLAs are present in issue TP-1
  3. SLA 1 has finished before its target and SLA 2 is still running and is already breached

If you run the previously given JQL, this issue will also be present. Because SLA 1 will comply with the isFinished() function and SLA 2 will comply with the isBreached() function, thus returning this issue as it fits with both of the functions. But this wasn't what you were trying to see. This is where the slaJoin function helps you. For ease of use we have made this function accepting what you have wrote in standard JQL so you can just copy and paste the query that you are trying to get.

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

Now when this query is called you will not be receiving the TP-1 in your results anymore!


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

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

Now this will return issues where either SLA is finished and breached or SLA is still running and its elapsed percentage is greater than 90.


slaJoin function only accepts inner queries where all the functions inside is SLA 3.0 JQL functions. Inner queries must only have the duration, date or percentage parameters. If you want to restrict your search by some SLAs you should give SLA ID or SLA name parameters to slaJoin function.

slaFunction = slaJoin("(slaFunction = isPaused() AND slaFunction = isBreached()) OR (slaFunction = isRunning() AND slaFunction >= elapsedPercentage(90))", 1, 2)



Attention

Other plugins may provide functions with the same name as those provided by Time to SLA such as isNotStarted. For functions like these, no other name would make a great deal of sense, so this is not surprising. The protocol for these situations is explained in JRA-24219, i.e. the plugin key that is first alphabetically will "win".