You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Calculate the Number of Working Days Since a Field Was Updated


Track and calculate the number of days since a custom field was updated in a scripted field.


I want to make sure my SLA's are on target and have not gone overdue. Using this script to calculate the days since a custom scripted field was updated, I can easily keep track of my teams to ensure we are delivering in accordance with our SLA's.

Good to Know

  • The custom field should be updated at least once in the lifetime of the issue for the script to work correctly.


  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
import com.atlassian.jira.component.ComponentAccessor final String customFieldName = "Custom Field Name" def startDate = Calendar.instance def endDate = Calendar.instance def changeHistoryManager = ComponentAccessor.changeHistoryManager def transition = changeHistoryManager.getChangeItemsForField(issue, customFieldName) startDate.setTime(transition*.created.max()) int weekDays = 0 while (startDate.timeInMillis < endDate.timeInMillis) { startDate.add(Calendar.DAY_OF_MONTH, 1) startDate.get(Calendar.DAY_OF_WEEK) in [Calendar.SATURDAY, Calendar.SUNDAY] ? null : ++weekDays } weekDays
Discovered an issue? Report it here

Suggested for you