Example: Getting the number of selected values in a custom field of type Multi Select
I'm looking for a solution to check number of selected values of a multi select custom field. Based on that result another custom field has to be set (e.g. to number of items selected in the field to be checked) Is there a way to use the "Update parameters" of the Mathematical and date-time expression calculator post-function for this transition functionality of Jira Workflow Toolbox?
I have just released version 2.0.18 of Jira Workflow Toolbox. This version implements a new function in the mathematical expression parser called "numberOfSelectedItems(field_id)". This function returns the number of items selected in a multi select field, version picker, multi user field, components, fix version/s, affects version/s and labels.
You can use post-function Mathematical and date-time expression calculator in the way I show you in the following screenshots:
Once configured, the transitions looks like this:
Notice that I have used an auxiliary field "Ephemeral number 1" as intermediary, instead of copying the result of "numberOfSelectedItems({Colours})" directly to custom field "Number of selected options". I have done it this way because there is a very strange bug in the plugin that prevents post-functions Copy parsed text to a field and Mathematical and date-time expression calculator to copy directly to custom fields (not to virtual fields) when the post-function is in first place in execution order. That is why I have introduced an assignment to an auxiliary field in first position, so that assignment to custom field is done in second position. Another possible workaround is to move the post-function to a lower position in the order of execution.
Update
The bug I talk about in the last message was fixed in version 2.1.16 of the plugin. Anyway, it only happened when writing into a custom field and issue resolution was set. Now it is not needed to use any intermediary field, so you can do it with only one post-function Mathematical and date-time expression calculator, selecting field "Number of selected options" as Target field, and introducing "numberOfSelectedItems({10600})" in parameter Formula.
Other examples of that function
- 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