Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Section


Column
width30%600px


Panel
borderColor#333f48
bgColor#FFFFFF
titleColor#eeeeee
borderWidth1
titleBGColor#333f48
borderStylesolid
titleOn this page

Table of Contents
maxLevel1



Column




Example: Calculate the time elapsed between 2 transition executions

I use post-function Mathematical and date-time expression calculator for calculating time between transitions. But I don't want to log work and use field "Time Spent". I want to use custom field and get time in minutes. How can I do it, using Jira Workflow Toolbox? And second question: Is any chance to get time between transitions in pretty duration format (for example, 1d 2h ).

In order to calculate the time between the execution of 2 different transitions (let's say "Transition A" and "Transition B"), and store the obtained value in minutes into a Number custom field you can use the following solution:

  1. Create Number custom field called "Time elapsed in minutes", where we will store the value obtained.

  2. Create a Date-Time Picker custom field called "Transition A Execution Time"

  3. Insert post-function Mathematical and date-time expression calculator into transition "Transition A" (i.e., the transition executed earlier) using the following configuration:

    • Target field: Transition A Execution Time
    • Formula: {00057}

  4. Insert post-function Mathematical and date-time expression calculator into transition "Transition B" (i.e., the transition executed later) using the following configuration:

    • Target field: select Time elapsed in minutes

    • Formula: ({00057} - {aaaaa}) / {MINUTE}
      replacing aaaaa with the field code of Transition A Execution Time custom field.

Transition A:

Image Removed

Image Removed

Once configured, the transition will look like this:

Image Removed

Transition B:

Image Removed

Image Removed

Text to be parsed is: ({00057}-{10201}) / {MINUTE}

Once configured, the transition will look like this:

Image Removed

Alternative Implementation

You can also represent the time duration between the 2 transition executions as a string in pretty format. To do it, also insert Copy a parsed text to a field post-function into "Transition B" with the following configuration:

  • Target field: a text custom field

  • Parsing mode: advanced

  • Text to be parsed:

    (floor(({00057} - {aaaaa}) / {DAY}) > 0 ? floor(({00057} - {aaaaa}) / {DAY}) + "d " : "") + (floor(modulus(({00057} - {aaaaa}), {DAY}) / {HOUR}) > 0 ? floor(modulus(({00057} - {aaaaa}), {DAY}) / {HOUR}) + "h " : "") + (round(modulus(({00057} - {aaaaa}), {HOUR}) / {MINUTE}) > 0 ? round(modulus(({00057} - {aaaaa}), {HOUR}) / {MINUTE}) + "m" : "")

    replacing aaaaa with the field code of Transition of Transition A Execution Time custom field.

Image Removed

Image Removed

Once configured, the transition will look like this:

Image Removed



Other examples of that functions

Mathematical and date-time expression calculator

Incoming Links
pageMathematical and date-time expression calculator
labelsexample



Copy a parsed text to a field

Incoming Links
pageCopy parsed text to a field
labelsexample



Related Usage Examples

Content by Label
showSpacefalse
cqllabel = "example" and label = "custom-field"