Automatic due date by issue type when creating ticket.

rozuan July 29, 2013

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.

5 answers

1 accepted

1 vote
Answer accepted
Tsol
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 29, 2013

Have a look here. Check Henning's answer.

0 votes
Danison Rarama November 9, 2018

Trying to Automatically assign a due date to all created ticket excluding weeks.

I tried this script but giving me an error for the first 3 lines
unable to resolve class com.atlassian.jira.component.componentaccessor

Im using Script runner cloud and just want to make sure all created tickets are automatically set for 5 days not including weekends.

 

```

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.MutableIssue
import java.sql.Timestamp;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfTimeline = customFieldManager.getCustomFieldObjectByName("Due Date")
def cfTimelineValue = issue.getCustomFieldValue(cfTimeline).toString()
// Days in the future when the issue is due. 
int DueInDays = 5
log.warn ("ASZ Timeline Value: "+ cfTimelineValue )
MutableIssue myIssue = issue;
// Set the number of days. 
switch (cfTimelineValue) {
case "1 - Immediately": DueInDays = 1; break;
case "2 - Today": DueInDays = 2; break;
case "3 - Business Week": DueInDays = 5; break;
case "4 - 30 Days": DueInDays = 30; break;
default: DueInDays = 5; break;
}
// Make sure the due date doesn't fall on a weekend. 
Date today = new Date();
Calendar MyDueDate = Calendar.getInstance();
MyDueDate.add(Calendar.DATE,DueInDays)
while ([Calendar.SATURDAY, Calendar.SUNDAY].contains(MyDueDate.get(Calendar.DAY_OF_WEEK))) {
MyDueDate.add(Calendar.DATE,1)

 

```

Casey Maynard April 12, 2019

Could someone add some direction as to how I can get my Due Date (or even a custom Due Date field) to Auto-populate from the Release Date value assigned to the Fix Version?

0 votes
Warren McInnes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 9, 2014

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

Kevin Dalton September 16, 2015

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

A November 4, 2015

any luck in identifying that??

Warren McInnes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 4, 2015

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

A November 5, 2015

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())

A November 5, 2015

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

Warren McInnes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2015

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

A November 5, 2015

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

0 votes
rozuan August 13, 2013

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);

0 votes
T I
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 29, 2013

Suggest an answer

Log in or Sign up to answer