Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Script Runner Escalation Question

Core Solutions Administrator January 30, 2019

Hello, I am trying to create a escalation script that will calculate the number of days an issue has been in the current status based on the last updated date. I am having problems with

a) Getting the last updated date

b) Passing a variable to the issueInputParameters 

Any thoughts or suggestions are appreciated. The code snipet is below:

Thank you!

import org.joda.time.Days
import org.joda.time.LocalDate

def days = Days.daysBetween(LocalDate.fromDateFields(issue.getCreated()), LocalDate.fromDateFields(new Date())).getDays()

def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'SLA Escalation'}
issueInputParameters.addCustomFieldValue(cf.id, days)

2 answers

0 votes
Core Solutions Administrator February 1, 2019

Thank you all for the suggestions. The scripted field worked well for tracking the number of days in a status. However the scripted field does not appear for selection in a two dimensional widget. Any suggestions?

0 votes
Chander Inguva
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.
January 30, 2019

Hey,

If you are using Script Runner plugin, there is in-built Escalation Service module which helps your need.

SR-EscalationServices.PNG

You can add your own JQL and custom script for additional issue actions.

 

Hope this helps

Thanks

Chander Inguva

Core Solutions Administrator January 30, 2019

Thank you for your response. 

We looked at the default options and they do not meet our need. We are looking to track how many days behind the SLA we were for specific transitions. For example, if the requirements need to be approved in 5 days, then we want a field to track the number of days it is delayed past the five days and we want to hold on to this information through the course of the project. 

Chander Inguva
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.
January 31, 2019

My guess is to use a Scripted field (date time field) and use JQL issuefunction on that field to calculate duration (< -5d)

Suggest an answer

Log in or Sign up to answer