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:

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)
