To implement this functionality we will use two custom fields and two post-functions
.
We want to automatically insert a work log for the time passed since triggering of "Start Progress" transition to triggering of "Stop Progress" transition.
Insert post-function Mathematical and date-time expression calculator into transition "Start Progress" to set custom field "Work Start Time" with the value of virtual field "Current date and time":
Note that:
Once configured, transition "Start Progress" looks like this:
Insert post-function Log work into transition "Stop Progress", using a time formula to calculate the number of minutes elapsed between "Start Progress" and "Stop Progress" transitions:
Math expression for obtaining the time elapsed in minutes: ({00057} - {10300}) / {MINUTE}
Note that:
Once configured, transition "Stop Progress" looks like this:
You can also implement the above use case but only considering the actual work time in your organization. To do it you should define your custom work-schedule using Schedules Definition Grammar at Administration > Add-ons > JIRA WORKFLOW TOOLBOX > Schedule
Let's consider the following work-schedule called "
my_work_schedule"
:
# Winter Schedule MON - THU { 08:00 - 15:00, 16:00 - 20:00; } FRI { 08:00 - 15:00; } # Summer Schedule JUN/15 - SEP/15 { MON - FRI { 08:00 - 14:30; } } # Annual Holidays JAN/1, MAY/1, NOV/1, DEC/25 {;} # 2017 Holidays 2017/JAN/12, 2017/APR/13, 2017/APR/14, 2017/NOV/23 {;} |
In order to use this custom work-schedule we should use the following configuration in post-function Log work:
Formula is: timeDifference({00057}, {10300}, "my_work_schedule", LOCAL) / {MINUTE}