Joining SLA Search Functions
This page is about Time to SLA for Jira On-Prem.
With SLA 3.0 JQL functions and the slaFunction custom field, you can easily search for your SLAs from indexes and get fast results without burdening your Jira. But since Time to SLA gives you the freedom to add multiple SLAs to issues, directly searching them with these functions may not give you the exact result that you are searching for.
For example, let’s say 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:
You have defined two SLAs: SLA 1 and SLA 2
Both of these SLAs are present in issue TP-1
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.
What’s the solution?
This is where the slaJoin function can help you. For ease of use, we have made this function accept what you have written 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.
For example, 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.
slaJoin function only accepts inner queries where all the functions inside are 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.