2 min read

The Script Series, Volume 2: Effortlessly Calculate Dates and Times in Jira with the Adaptavist Library

AD
Andra Dinu
Wed, 3 Apr 2019 ScriptRunner
The Script Series, Volume 2: Effortlessly Calculate Dates and Times in Jira with the Adaptavist Library

The Script Series, Volume 2: Effortlessly Calculate Dates and Times in Jira with the Adaptavist Library

This is the second in a series of blogs aiming to demonstrate the capability of script collections in the Adaptavist Library.

Collections are groups of scripts with similar functionalities, meaning you can easily find the scripts that may benefit you.

If you’re new around here, it’s time for a quick recap. Check out our other blog posts in The Script Series below to find out more:

 

  • In Volume 1, we explored how our ‘Users and Groups in Jira’ collection helps make bulk actions easy, such as updating all users in a group at once.
  • In Volume 3, we collaborated with our Partner, ALM Works, to help you utilise the power of ScriptRunner and Structure together. This collection provides ways to automate, extend and customise your structures in Jira.
  • In Volume 4, we show you five simple scripts to automate issues in Jira.

For the second instalment of The Script Series, we will be delving into the collection ‘Working with Dates and Times’. When trying to automate or extend the built-in workflows Jira provides, it’s common to need to work with Dates, Times and Intervals. It can be very useful for teams to calculate how long an issue has been in a given workflow state, or to know the amount of logged time an issue has. However, we know that this can be time consuming, which is why we have brought you this collection of useful scripts. 

Screen Shot 2019 04 03 at 15.46.48

Script 1 - Store the time when an issue was first transitioned

Use this helpful script to get the date an issue was first transitioned through a particular action. It doesn’t matter if it undergoes the same transition multiple times, only the first date is shown. Perhaps you work in support, you might want to track when a customer was first responded to, this can quickly be achieved by using this script in the support workflow. 

Script 2 - Calculate the difference between two dates

You may need to calculate the number of overall days between two custom date fields and don't want to spend time manually tracking the dates. This snippet will save you time by automatically doing this for you. For example, you might have an impending project deadline coming up, and you need to see how long the project has been running for and make sure that your team is on track to complete the project on time. 

Script 3  - Calculate the working days between two dates

Now, you can easily calculate the working days between two dates with this script. For instance, you might need to work out the average working days that it takes to resolve an issue. So, you can use this snippet to track the working days between when an issue was first raised and when it was resolved.

What’s Next?

You’ve found out how to use dates and times to automate your Jira processes, but are you looking for some scripts to help you get started with Project Configurator? If so, keep an eye out for the next post, which explores the ‘Getting started with Project Configurator’ collection and its most common use cases.

Haven’t tried out the Adaptavist Library yet? Check it out 

 


Stay up to date by signing up for monthly Adaptanews