Hello Community,
I have a requirement to calculate the cost of a breached SLA. I thought I can use the remaining time of SLA custom field and a ScriptRunner Script Field.
My question is about the value of the remainingTime using the bellow script in Script Console:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue;
// Key of a Service Desk Issue
Issue subIssue = ComponentAccessor.getIssueManager().getIssueObject("KEY")
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def timeToSlaField = customFieldManager.getCustomFieldObjectByName("NAME OF SLA FIELD");
def value = timeToSlaField.getValue(subIssue)
// remaining time in milliseconds
def remainingTime = value.ongoingSLAData.thresholdData.get().remainingTime.get()
The script returns a value in milliseconds that is different from the one displayed in the GUI (issue view, queues...) and I can not figure out how to understand it.
At the beginning when the issue is created it seems that the remainingTime is set to the value of the SLA goal then the value changes but not every millisecond (?)
For example on the image below an issue on which 19 min remains until SLA breach.
time to first answer vs. remainingTime in milliseconds from the script
Any help would be greatly appreciated :)
Thanks
Hi everyone!
Since I'm using Jira Service Desk, I found a solution for this case by using Jira Service Desk REST API https://docs.atlassian.com/jira-servicedesk/REST/3.6.2/
Hi everyone!
I've faced the same problem. For instance, I need to get issues in which approvals are 10 hours overdue. I can find them with the following JQL: 'cf[12000] <= remaining("-10h")', where cf[12000] is an SLA CustomField Type custom field.
However, I can't get the remaining time from the custom field via a script the way @Tsuyoshi Shimabukuro has described. The remainingTime value doesn't seem to change in issues with ongoing SLA. At least, it doesn't change in the real time. Is there any update time interval for this value or do I get the remainingTime wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.