🚀 JWT 3.0 is out 🚀 

The app was completely overhauled, and so was the documentation: Jira Workflow Toolbox (Server/Data Center) Home

The page you are viewing is still valid for all app versions prior to 3.0.

On this page


Features used to implement the example



Example: Automatically log work time when the user uses a "Stop Progress" transition

Is it possible to log work using a post-function? Are there any other means of achieving this?

What we want to achieve is to automatically log work time when the user presses the Stop Progress button, either by automatically logging the work time or by setting the time in the Work Time field in the stop progress screen.

Yes, you can do it. You have to use the following elements:

  • Virtual field "Total time spent (minutes)". Writing into this virtual field allows you to log time
  • Virtual field "Current date and time"
  • An auxiliary custom field of type Date Time to store the time where you start progress. In the example I call this field "Start Progress Time"
  • Post-function Mathematical and date-time expression calculator to do all the calculations and assignments into virtual field "Total time spent (minutes)"

We only need to insert post-function Mathematical and date-time expression calculator into two transitions: "Start Progress" and "Stop Progress". 

Transition "Start Progress": We insert post-function Mathematical and date-time expression calculator in transition "Start Progress" to store into custom field "Start Progress Time" the exact moment when you begin working on the issue. This custom field should not be present in edit screen since you only want it to be modified by this post-function. Let's see in screenshots how to do it:


Once configured, the transition will look like this:



Transition "Stop Progress": We insert post-function Mathematical and date-time expression calculator in transition "Stop Progress" to calculate the true time passed since "Start Progress" to "Stop Progress", and add this time to the value already present in virtual field "Total time spent (minutes)". Let's see how to do it:



Once configured, the transition will look like this:



This solution trims seconds passed since last whole minute, that is, if time passed since "Start Progress" to "Stop Progress" were 35 minutes 22 seconds, logged time would be 35 minutes. I could add a new virtual field "Total time spent (seconds)" to enable a resolution up to seconds.

Since version 2.2.39  you can do the time calculation considering only a particular work schedule, i.e., only the days and times when actual work is done. To do it you should use the following formula instead:

timeDifference({00057}, {nnnnn}, "my_schedule", LOCAL) / {MINUTE}

Where my_schedule is the name of your particular work schedule. You define your schedule using Schedules Definition Grammar at Administration > Add-ons > JIRA WORKFLOW TOOLBOX > Schedule.



Related Usage Examples