Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

script runner duration field Edited

Hello I need to make field like a SLAs field in SD in JIra.
This field have to change the value depend on time spending and type of priority.

Blocker –  15m, 8h

High – 30m, 15h

Medium – 1d, 32h

Low – 1d, 40h.

if priority is blocker the reaction time should show 8h 15 min from create (change) the issue.

how can I do it using script runner filed

Screen Shot 2020-05-20 at 17.17.13.png

1 answer

0 votes

You can try something like this:

import groovy.time.TimeDuration
def map = [
Blocker : new TimeDuration(0,8,15,0,0),
High : new TimeDuration(0,15,30,0,0),
Medium: new TimeDuration(1,32,0,0,0),
Low: new TimeDuration(1,40,0,0,0)
def duration = map[]
(duration) ? duration.toMilliseconds()/1000 as Long : null

The TimeDuration constructor is: TimeDuration​(int days, int hours, int minutes, int seconds, int millis)

And the Jira duration fields expects a number of seconds as Long

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

How to create a Confluence page linked to a Jira cloud ticket

Have you been looking for a solution to easily create Confluence pages directly from a Jira Cloud issue? The no code solution is here with the brand new app Elements Publish to Confluence, which work...

51 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you