Automatic due date by issue type when creating ticket.

Hi,

I need a way to do automatic due date by issue type when creating a ticket. For example, I have an issue type which need to resolve within 3hours. How to set this?

Thank you.

4 answers

1 accepted

Have a look here. Check Henning's answer.

Thanks all. I have found the way in atlassian answer also and I do this by using Script Runner.

And the script as below:

mport com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.CustomFieldType
import com.atlassian.jira.issue.fields.CustomField
import java.sql.Timestamp;
 
MutableIssue myIssue = issue
 
Calendar cal = Calendar.getInstance();
// set due date to: current date + 8 days
Timestamp mydueDate = new Timestamp(cal.getTimeInMillis()+ 8*1000*24*60*60);
  
 
myIssue.setDueDate(mydueDate);

Hi, Yes this code does work correctly.

How ever is there any way to exclude weekends? Or for instance if the due date falls on a weekend that it gets changed to the very next monday?

Thanks in advance

Would be curious if there is a way to exclude weekends or if it is on a weekend to push it till monday.

any luck in identifying that??

I think JIRA handles this automatically? I haven't looked into this for quite sometime.

Hi Warren, Below is my code. Currently not working with working days def dateField = getCustomFieldValue("customfield_11111") def numberField = getCustomFieldValue("customfield_11234") def number = numberField?.intValue() if (!number || !dateField) return def result = dateField + number return new Date(result.getTime())

i am adding the duration and calculating the end date, but end date is added to date. not to calender days

Is end date a custom field? or are you trying to populate the due date?

yes its a customfield i am trying to add start date with duration and out put to be displayed on scripted field. So far only reached till adding date with duration, but it is considering sunday and saturday also. my duration is purely calender days

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

807 views 2 19
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you