---
title: "Get the End Date of the SLA of an Issue"
canonical: "https://support.appfire.com/space/JMWE/461931395/Get%20the%20End%20Date%20of%20the%20SLA%20of%20an%20Issue"
format: markdown
---
> Macro (aura-html)

## Abstract

This code snippet accesses a specified Service Level Agreement (SLA) of the issue and adds the remaining time to the current date.

> ⚠️ **Please note: **Service Level Agreements are only available in **Service Management projects** when using **Jira Service Management**.

## Logic

- Access the threshold data of the ongoing SLA
- Access the remaining time from the threshold data
- Add the remaining time to the current date

## Snippet

```groovy
use(groovy.time.TimeCategory){
	def remainingTime = issue.get(<SLA>)?.ongoingSLAData?.thresholdData?.get()?.remainingTime?.get()
	if (remainingTime){
  		new Date() + (remainingTime / 60000).toInteger().minutes
	}
}
```

## Placeholders

| **Placeholder Text** | **Description** | **Example** |
| --- | --- | --- |
| `<SLA>` | Name of the Service Level Agreement whose end date should be calculated | `'Time to resolution'` |

## **Examples**

The output of the code snippet above is a [Timestamp](http://docs.oracle.com/javase/7/docs/api/java/sql/Timestamp.html) which you could use in a Groovy expression.

### **Set a Date/Date-time picker field** 

Set the Due date to the end of the “Time to first response” SLA in

- one of the Set Field Value post-functions
- the Create issue post-function under Set fields of new issue section

**Related articles**

> Macro (contentbylabel)