Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
A Calculated (scripted) Date custom field type represents a java.util.Date calculated from a Groovy script.
Sample use cases:
Calculate and display the Sprint end date in the statistics
Create a Calculated (scripted) Date custom field type, Sprint End Date, from the Custom fields administration page.
Click on Configure
Click on Edit Groovy Formula and write the following formula in the editor
for (Object sprint : issue.get("Sprint")) {
if (sprint.isActive())
return sprint.getEndDate().toDate();
}
Click on “Save”
Add this field in the statistics gadgets
Calculated (scripted) Date/Time custom field type
A Calculated (scripted) Date/Time custom field type represents a java.util.Date and is displayed as date+time.
Sample use cases:
Calculate and display the probable date of resolution (excluding weekends) for an issue based on its Priority
Create a Calculated (scripted) Date/Time custom field type, Probable resolution, from the Custom fields administration page.
Click on Configure
Click on Edit Groovy Formula and write the following formula in the editor
Date date(Date from, int nod){
Calendar c1 = GregorianCalendar.getInstance();
c1.setTime(from);
int weeks = nod/5;
int remDays = nod%5;
//Adding whole weeks
c1.add(Calendar.WEEK_OF_YEAR, weeks);
//Run a loop and check each day to skip a weekend
for(int i=1;i<=remDays;i++){
c1.add(Calendar.DAY_OF_MONTH, 1);
if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
c1.add(Calendar.DAY_OF_MONTH, 1);
if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
c1.add(Calendar.DAY_OF_MONTH, 1);
}
//Skip ending weekend
if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
c1.add(Calendar.DAY_OF_MONTH, 1);
if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
c1.add(Calendar.DAY_OF_MONTH, 1);
//move to 0:00
c1.clearTime();
return c1.getTime();
}
def from = issue.get("created")
switch (issue.getAsString("priority")) {
case "Highest" || "High" : return date(issue.get("created"),2);
case "Medium" : return date(issue.get("created"),4);
case "Low" || "Lowest" : return date(issue.get("created"),5);
default : return date(issue.get("created"),5);
}
Click on Save.
Click on Edit Date Format and select DATE_TIME_PICKER.
Click on Save.
Calculate and display the Sprint end date as a relative date in the Issue Navigator.
Create a Calculated (scripted) Date/Time custom field type, Sprint end date from the Custom fields administration page.
Click on Configure
Click on Edit Groovy Formula and write the following formula in the editor
for (Object sprint : issue.get("Sprint")) {
if (sprint.isActive())
return sprint.getEndDate().toDate();
}
Click on Save.
Click on Edit Date Column Format and select RELATIVE.
Click on Save.
Calculated (scripted) Duration custom field type
A Calculated (scripted) Duration custom field type represents a duration and is displayed either as a duration string or as a number in a Long format representing the number of seconds.
Sample use cases:
Calculate and display how many days an issue has been open
Create a Calculated (scripted) Duration custom field type, Open since, from the Custom fields administration page.
Click on Configure
Click on Edit Groovy formula and write the following formula.
A Calculated (scripted) Number custom field type represents a number and is displayed in Double format.
Sample use cases:
Calculate the sum of two number field and round off the result
Create a Calculated (scripted) Number custom field type: Sum, from the Custom fields administration page.
Click on Configure
Click on Edit Groovy Formula and write the following formula.
def result = (issue.get("customfield_16003") ? issue.get("customfield_16003") : 0) + (issue.get("customfield_16004") ? issue.get("customfield_16004") : 0)
result == 0?0:result.round() //returns 0 when the result is 0 and rounds off the result when there is a value
Click on Save.
Calculate and display the number of Stories associated to the Epic.
Create a Calculated (scripted) Number custom field type: Total Stories, from the Custom fields administration page.
Click on Configure
Click on Edit Groovy Formula and write the following formula.
if (issue.stories){
return issue.getStories().size()
}
else{
return 0
}
Click on Save.
Calculate and display the number of unresolved issues blocking the current issue.
Create a Calculated (scripted) Number custom field type: Number of Blocking Issues, from the Custom fields administration page.
Click on Configure
Click on Edit Groovy Formula and write the following formula.
Calculated (scripted) Single-user custom field type
A Calculated (scripted) Single-user custom field type represents an ApplicationUser and is displayed as a String representing the display name of the user.
Sample use cases:
Calculate and display the user who last commented on the issue
Create a Calculated (scripted) Single-user custom field type: Last Commented by, from the Custom fields administration page.
Click on Configure
Click on Edit Groovy Formula and write the following formula.
A Last Field Value change Author custom field type that represents the author of the last modification made to a field and is displayed as a String representing the display name of the user.
Sample use cases:
Calculate and display the author who has last added this issue to a Sprint
Create a Last Field Value Change Author custom field type: Moved to Sprint by, from the Custom fields administration page.
Click on Edit Field to look for
Select the Sprint field.
Click on Save
Last Field Value Change Date/Time custom field type
A Last Field Value Change Date/Time custom field type represents a java.util.Date and is displayed as date+time.
Sample use cases:
Calculate and display the last time the issue was Flagged.
Create a Last Field Value Change Date/Time custom field type: Last Flagged, from the Custom fields administration page.
Click on Edit Field to look for
Select the Flagged field.
Click on Save
Parent Status custom field type
A Parent status calculated custom field type represents the status of the issue's parent issue, if any, and is displayed as a String representing the status name.
Sample use cases:
Calculate and display the status of the parent issue and the name of the user to whom the issue is assigned.
Create a Parent Status custom field type: Parent Status field, from the Custom fields administration page.
Click on Edit Velocity Template
Write the following template
#if ($issue.assignee.name)
$formattedValue and assigned to $issue.assignee.displayName
#else
$formattedValue
#end
Status entered by user custom field type
A Status entered by user custom field type represents a user who last (or first) moved the issue to the specified status and is displayed as a String representing the user display name.
Sample use cases:
Calculate and display the author name and the email address of the user who first Approved the issue
Create a Status entered by user custom field type, First Approved on, from the Custom fields administration page.
Click on Edit Statuse(s) to look for.
Select the Approval status.
Select Earliest from Which transition execution field