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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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[issue.priority.name]
(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
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Do Not Lose your Customer’s Trust

Missing deadlines is one of the biggest problems every team lead wants to avoid when dealing with managed services. When the customer contracts your company to help with IT services it is expected th...

312 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