# Getting SLA Information

**URL:** <https://community.developer.atlassian.com/t/getting-sla-information/62867>\
**Category:** Jira Data Center\
**Tags:** scriptrunner\
**Created:** [October 25, 2022, 8:00am UTC](https://community.developer.atlassian.com/t/getting-sla-information/62867 "2022-10-25T08:00:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KCWong](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@KCWong](https://community.developer.atlassian.com/u/KCWong)\
**Post date:** [October 25, 2022, 8:00am UTC](https://community.developer.atlassian.com/t/getting-sla-information/62867/1 "2022-10-25T08:00:04Z")

</div>

I have the requirement of setting a date field according to SLA.

e.g. If the issue matches SLA goal 1, which has a duration of 10 days, then I am to set the date field to today + 10 days.

While there is no API to retrieve SLA settings (for the **project** , not a specific issue), I managed to grab the goals from database directly:

```auto
SELECT 
    g.JQL_QUERY, g.TARGET_DURATION 
FROM 
    "AO_54307E_GOAL" g
    JOIN "AO_54307E_TIMEMETRIC" tm ON tm.ID = g.TIME_METRIC_ID
    JOIN "AO_54307E_SERVICEDESK" sd on tm."SERVICE_DESK_ID" = sd."ID"
    JOIN project p on sd."PROJECT_ID" = p.id
WHERE
    p.pkey = 'PROJ1'

```

And I know I can execute JQL query from ScriptRunner:

> **[Perform a JQL Search in ScriptRunner for Jira - Adaptavist Library](https://library.adaptavist.com/entity/perform-a-jql-search-in-scriptrunner-for-jira)**
>
> Overview
> Use this snippet to look for issues based on a JQL search.
> This code can be used as part of a larger bulk-administration or workflow automation task, in the Script Console and other features.
> Example
> The available issue resolutions in a...

The problem is my issue could be in memory (in ScriptRunner mail handler, not saved yet).

How can I compare my in memory issue against the JQL?

I can probably save the issue first then update timeline as a workaround, but ideally I want to do it before saving.
