Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Export SLA Metrics, goals and Conditions for all projects

Sergey Kislitsyn June 1, 2021

Hello

 

I need to export SLA Metrics, Goals, Conditions & Calendars from all Service Desk Projects.
How can I do that? I did't find that data in Database.

 

Then I tried ServiceDesk java API. But the following code gave me only 1 condition: Issue Created, while I see 3 even in 1 SLA metric (project has 2 metric, 5 different start condition)

What I got from ScriptRunner console:

photo_2021-06-01_15-00-45.jpg

import com.atlassian.servicedesk.spi.sla.condition.TimeMetricConditionFactory
import com.atlassian.servicedesk.spi.sla.condition.TimeMetricHitCondition
import com.atlassian.servicedesk.spi.sla.condition.TimeMetricMatchCondition
import com.atlassian.jira.util.I18nHelper
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.Project

@WithPlugin("com.atlassian.servicedesk")
@PluginModule
TimeMetricConditionFactory timeMetricConditionFactory

def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def projectManager = ComponentAccessor.getProjectManager()
Project project = projectManager.getProjectObjByKey("ATLAS")
I18nHelper loc = ComponentAccessor.i18nHelperFactory.getInstance(user)

def metricHitConditions = timeMetricConditionFactory.getAllHitConditions(project)
Iterator<? extends TimeMetricHitCondition> it = metricHitConditions.iterator()
log.error("Count all Hit conditions: ${metricHitConditions.size()}")

while (it.hasNext()) {
TimeMetricHitCondition item = it.next();
log.error("Name of the Hit condition: ${item.getName(loc)}")
}

def metricMatchConditions = timeMetricConditionFactory.getAllMatchConditions(project)
Iterator<? extends TimeMetricMatchCondition> iter = metricMatchConditions.iterator()
log.error("Count all Match conditions: ${metricMatchConditions.size()}")

while (iter.hasNext()) {
TimeMetricMatchCondition item = iter.next();
log.error("Name of the Match condition: ${item.getName(loc)}")
}

 

What I need:

Metrics name, when it changed, all conditions and goals (including JQL)

photo_2021-06-01_14-58-56.jpg

 

2 answers

1 accepted

1 vote
Answer accepted
Daniel Ebers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2021

Hi @Sergey Kislitsyn

based on your description I believe to understand that you do not want to request the SLA data for a specific (customer) request in your service management project but rather the data for configuration of each project, is this correctly understood?

In the REST API reference (https://docs.atlassian.com/jira-servicedesk/REST/4.17.0/) there are only examples that are referring to a single request, raised by a customer.

Also this Suggestion seems only to refer to single issues:
https://jira.atlassian.com/browse/JSDSERVER-2001 (this is the one that in the end links to REST API reference).

 

Judging from another Suggestion (https://jira.atlassian.com/browse/JSDCLOUD-9973) which is indeed for Cloud but in the end it will be the same for Jira Server there is no option currently to access all SLA data via API.

Probably somebody has some more tricks but I believe so far when the API exposes not the data in an appropriate way or not at all they cannot be gathered.

Also somebody suggested to expose calendar data via API, which leads me to the assumption, this data is not yet exposed via API.

https://jira.atlassian.com/browse/JSDSERVER-5623

Cheers,
Daniel

1 vote
Mirosław Pruchnik June 4, 2021

Hi Sergey,

Coincidentally I'm looking how to retrieve exactly the same information from Service Desk and I'm getting exactly same results unfortunately, i.e. nothing :( Not very encouraging to say the least.

Cheers,
MiPr

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events