Features used to implement the example
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:
- Create Number custom field called "Time elapsed in minutes", where we will store the value obtained.
- Create a Date-Time Picker custom field called "Transition A Execution Time"
- 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}
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.
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 A Execution Time custom field
Other examples of that functions
Mathematical and date-time expression calculator
- Automatic work log with start and stop work transitions
- Automatically log work time when the user uses a "Stop Progress" transition
- Calculate the time elapsed between 2 transition executions
- Getting the number of selected values in a custom field of type Multi Select
- Implement a form with a series of questions and calculate a numeric value based on the answers
- Increment a field or set to 1 if it's not set
- Set "Date-Time Picker" custom field with current date-time
- Set "Due date" 6 natural days (or work days) earlier than a "Date Picker" custom field
- Set "Due date" to a specific day of next week no matter of date of creation this week
- Set "Due date" with certain time offset from current date
- Set "Total time spent" to "Current date and time - date and time of last update"
- Set a custom field "Urgency" depending on a combined value of issue's priority and "Impact" custom field
- Sum "Time Spent" in all sub-tasks of issues linked with issue link types "LinkA", "LinkB", "LinkC"
- Triage Jira Service Desk email requests (Move issues)
- Using project properties to calculate custom sequence numbers
- Add all assignees of certain sub-task types to a "Multi-User Picker" custom field
- Add and remove a single or a set of items from multi valued fields
- Add current user to comment
- Add or remove request participants
- Add watchers from a part of the issue summary: "Summary_text - watcher1, watcher2, watcher3, ..."
- Assign issue based on the value of a Cascading Select custom field
- Assign issue to last user who executed a certain transition in the workflow
- Automatically close resolved sub-tasks when parent issue is closed
- Automatically reopen parent issue when one of its sub-tasks is reopened
- Calculate the time elapsed between 2 transition executions
- Close parent issue when all sub-tasks are closed
- Combine the values of several Multi-User picker fields
- Compose a parsed text including the "full name" or a user selected in a User Picker custom field
- Compose dynamic text by inserting field values in a text template
- Copy issue labels to a custom field
- Copy the value of a user property into a user picker
- Create a comment in sub-tasks when parent transitions
- Execute transition in epic
- Getting the number of selected values in a custom field of type Multi Select
- Limit the number of hours a user can log per day
- Make a sub-task's status match parent issue's current status on creation
- Make parent issue progress through its workflow
- Moving story to "In Progress" when one of its sub-tasks is moved to "In Progress"
- Moving story to "Ready for QA" once all its sub-tasks are in "Ready for QA" status
- Parse Email adresses to watchers list
- Parsing text from last comment and appending it to issue's summary
- Remove versions selected in a version picker custom field
- Replace certain issue link types with different ones
- Restrict parent issue from closing if it has sub-tasks that were created during a given parent issue status
- Set a Select or Multi-Select field using regular expression to express the values to be assigned
- Set assignee depending on issue type
- Set field depending on time passed since issue creation
- Set priority for issues that have been in a certain status for longer than 24 hours
- Set security level based on groups and project roles the reporter or creator are in
- Transition linked issues in currently active sprint
- Transition only a sub-task among several ones
- Transition parent issue only when certain issue sub-task types are done
- Update Cascading Select custom field with a value of the field in parent issue
- Update checkboxes custom field if a file has been attached during a transition
- Validation on issue attachments
- Validation on MIME types of issue attachments
- Writing a comment to blocked issues when blocking issues are resolved