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:
{00057}
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.
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 A Execution Time custom field