This section has use cases which help you understand the usage of the Calculated fields provided by JMCF.
On this page:
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
Calculate and display the Sprint end date as a relative date in the Issue Navigator.
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
Calculate the duration the field has been Flagged
Calculate and display the number of days from issue creation to resolution in a custom field
Calculate and display the difference between the current Due date and the last Due date.
Create a Calculated (scripted) Duration custom field type, Due change, from the Custom fields administration page. Click on Configure Click on Edit Groovy Formula and write the following . import java.text.SimpleDateFormat;
Date curDueDate = issue.get("duedate");
if (curDueDate == null)
return null;
if (issue.getFieldHistory("duedate").size() == 0)
return null;
oldVal = issue.getFieldHistory("duedate")[-1].getFrom()
if (oldVal==null)
return null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date oldDueDate = sdf.parse(oldVal);
return (curDueDate.getTime() - oldDueDate.getTime())/1000L; |
- Click on
Save .
|
|
Calculate and display the Total Original Estimate of all the Stories associated to the Epic.
Calculate and display the Remaining Estimate of all the Stories associated to the Epic.
Create a Calculated (scripted) Number custom field type: Total Remaining Estimate , from the Custom fields administration page. Click on Configure. Click on Edit Groovy Formula and write the following formula. def totalRE = 0
issue.getStories().each{
totalRE += it.get("timeestimate",0)
}
return totalRE |
- Click on
Save . - Select the
Duration in the configuration as Duration (Time Tracking Format)
|
|
Calculated (scripted) Multi-select custom field type
A Calculated (scripted) Multi-select custom field type represents a collection of Options and is displayed as a String representing the option values.
Sample use cases:
Calculate and display the access to be provided to the user in a custom field based on the project role the user belongs to.
Calculated (scripted) Multi-user custom field type
A Calculated (scripted) Multi-user custom field type represents a collection of users and is displayed as a String representing the user display names
Sample use cases:
and display the assignees of the sub-tasks on the parent issue.
Calculated (scripted) Number custom field type
A Calculated (scripted) Number custom field type represents a number and is displayed in Double format.
Sample use cases:
and display the number of Stories associated to the Epic.
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. return issue.getLinkedIssues("is blocked by").findAll{
it.get("resolution") == null
}.size() |
- Click on
Save .
|
|
Calculate and display the number of times "Expected Delivery Date" has been modified.
Create a Calculated (scripted) Number custom field type, Expected Delivery Date updated , from the Custom fields administration page. Click on Configure Click on Edit Groovy Formula and write the following formula. return issue.getFieldHistory("Expected Delivery Date").size() |
- Click on
Save .
|
|
Calculate and display the number of issues linked to the current issue with link type "Interface" and the Affects Version/s "Platform".
Calculated (scripted) Single-select custom field type
A Calculated (scripted) Single-select custom field type represents an Option and is displayed as a String representing an Option value.
Sample use cases:
Calculate and display the company name with logo based on the value provided in the text field holding the URL of the company
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
Calculate and display the user who last modified the issue
Calculated (scripted) Text/Html custom field type
A Calculated (scripted) Text/Html custom field displays text calculated using a Groovy script and supporting HTML formatting.
Sample use cases:
Calculate and display the last comment, its author, and timestamp in a text field.
Calculate and display the current issues' linked issues with "is blocked by" link type and are not in Resolved
or Closed
status.
- Create a Calculated (scripted) Text/Html custom field type:
Blocking issues , from the Custom fields administration page.
the following . return issue.getLinkedIssues("is blocked by").findAll{
it.get("status").name!= "Resolved" || it.get("status").name!= "Closed"
}*.key.join(",") |
- Click on
Save .
|
|
Calculate and display all the previous due dates as comma separated list with dates in YYYY-MM-DD format.
Calculate and display estimated hours for each day, using not more than 8 hours per day, until the due date.
Calculate and display the location of the Assignee of the issue from the User properties
Calculate and display all of a specific user.
Calculate and display the Project category of the issue's project
Flag the issue on the issue view screen if the has been flagged.
Calculated (scripted) Wiki Text custom field type
A Calculated (scripted) Wiki custom field displays text calculated using a Groovy script and optionally supporting wiki-style formatting.
Sample use cases:
Calculate and display the last comment, its author, and timestamp in a text field without escaping the formatting .
Last Field Value Change Author custom field type
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
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.
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.
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 - Click on
Save .
|
|
Status entered on date/time custom field type
A Status entered on Date/Time custom field type represents a date+time the issue has been last (or first) moved to the specified status and is displayed as date+time.
Sample use cases:
Calculate and display the date/time an issue entered the Approval status for the first time
- Create a Status entered on date/time 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 - Click on
Save .
|
|
Time in status custom field type
A Calculated Time in status 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 the time spent in the Pull request status
- Create a Time in status custom field type,
Time in Pull request, from the Custom fields administration page. - Click on
Edit Statuse(s) to look for. - Select the statuses you would like the calculated field to look for.
- Click on Save.
|
|
Calculate and display the total resolution time for a ticket in an error banner if the time spent is more than 3 days
Calculate and display the time spent in current status
- Create a Time in status custom field type,
Total resolution time, from the Custom fields administration page. - Click on
Edit Statuse(s) to look for. - Select Current Status from the list of statuse(s)
- Click on
Save.
|
|
Transition Caller custom field type
A Transition Caller custom field type returns the user who first/last executed a specific workflow transition and is displayed as a String representing the display name of the user.
Sample use cases:
who last fixed the issue
- Create a Transition caller custom field type,
Last fixed by, from the Custom fields administration page. - Click on
Edit Transition(s) to look for. - Provide the transition name or ID of the transition to Fixed status, either manually or using the Transition picker
- Click on
Add . - Click on
Save . - Select
Latest from the Transition Execution field.
|
|
Calculate and display the author who has resolved the issue across different workflows with different transitions.
- Create a Transition caller custom field type,
Last fixed by, from the Custom fields administration page. - Click on
Edit Transition(s) to look for. - Click on the Transition picker.
- Select the workflow name and the transition that leads to the Resolved status
- Click on
Add - Repeat the same with all the other transitions that lead to Resolved status.
- Click on
Save . - Select
Latest from the Transition Execution field.
|
|
Calculate and display the creator of the issue along with his/her username.
Transition Callers custom field type
A Transition Callers custom field type rreturns the users who triggered a specific workflow transition and is displayed as a String representing the display names of the users.
Sample use cases:
Calculate and display the authors who approved the ticket
- Create a Transition callers custom field type,
Approved by, from the Custom fields administration page. - Click on
Edit Transition(s) to look for. - Select the "Approve" transition using the Transition picker
- Click on
Add . - Click on
Save .
|
|
Calculate and display the authors who have Reviewed and Approved the ticket
- Create a Transition callers custom field type,
Reviewed and Approved by, from the Custom fields administration page. - Click on
Edit Transition(s) to look for. - Select the "Approve" and "Review" transitions using the Transition picker
- Click on
Add . - Click on
Save .
|
|
Transition Count custom field type
A Transition Count custom field represents the number of times a specified workflow transition(s) was executed and is displayed as a number in Double format.
Sample use cases:
Transition Date/Time custom field type
A Transition Date/Time custom field type represents a java.util.Date
and is displayed as date+time.
Sample use cases:
Calculate and display the date/time when the issue has been last approved.
- Create a Transition Date/Time Custom field type,
Last Approved on, from the Custom fields administration page. - Click on
Edit Transition(s) to look for. - Provide the transition name or ID either manually or using the Transition picker
- Click on
Add . - Click on
Save . - Select
Latest from the Transition Execution field. - Click on
Edit Date Format - Select
RELATIVE - Click on
Save
|
|